ããã¯ãªã«? Sub::Pipe ã¯é常ã«å°ç²ãªã¢ã¸ã¥ã¼ã«ã§ããã©ããããå°ç²ãã¨ããã¨ãæ¬è³ªé¨å㯠package Sub::Pipe; use overload '|' => sub { $_[0]->( $_[1] ) }; sub joint(&) { bless $_[0], __PACKAGE__ }; ãã® 3è¡ã®ã¿ãã¨ãããããå°ç²ãªããã§ããããªããªããããããã¢ã¸ã¥ã¼ã«ãããªããã¨æã£ã¦ãã¾ãã Sub::Pipe ã使ãã¨ãUNIX pipe ã®ãããªè¨æ³ã§é©ç¨ããé¢æ°ãä½æã§ãã¾ãã use Sub::Pipe; sub trim { joint { my $str = shift; $str =~ s/^\s+|\s+$//g; return $str; } } $foo = " foo " | trim; # is $foo, "foo" ããã¯æååã®åå¾ã®ç©º
{{#tags}}- {{label}}
{{/tags}}