sub func {} my $x; sub foo { ++$x } $x = 0; func foo(), 1,2,3; print "$x\n"; # 1 $x = 0; grep foo(), 1,2,3; print "$x\n"; # 3 #### grep &cb, ... === grep { &cb } ... grep &cb(), ... === grep { &cb() } ... grep $cb->(), ... === grep { $cb->() } ... grep /.../, ... === grep { /.../ } ... grep substr($_, 2), ... === grep { substr($_, 2) } ... #### sub mymap (&@) { my ( $code, @list ) = @_; map &$code, @list } sub get_cb { return sub { uc } } print(( mymap \&{ &get_cb }, qw( a b c ) ), "\n"); print(( map &get_cb, qw( a b c ) ), "\n"); print(( map get_cb, qw( a b c ) ), "\n"); print(( map get_cb(), qw( a b c ) ), "\n"); #### ABC CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54) CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54) CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54)