Help for this page

Select Code to Download


  1. or download this
    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
    
  2. or download this
    grep &cb,           ...  === grep { &cb           } ...
    grep &cb(),         ...  === grep { &cb()         } ...
    grep $cb->(),       ...  === grep { $cb->()       } ...
    grep /.../,         ...  === grep { /.../         } ...
    grep substr($_, 2), ...  === grep { substr($_, 2) } ...
    
  3. or download this
    sub mymap (&@) { my ( $code, @list ) = @_; map &$code, @list }
    
    ...
    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");
    
  4. or download this
    ABC
    CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54)
    CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54)
    CODE(0x1829a54)CODE(0x1829a54)CODE(0x1829a54)