Help for this page

Select Code to Download


  1. or download this
    sub imap {
        my ($transform, $it) = @_;
    ...
            return $transform->($next);
        }
    }
    
  2. or download this
    #!/usr/bin/env perl
    use 5.010;
    ...
    
    my @a = ( "1", "2", "3", "4", );
    my @b = foo { $_ ** 2 } @a;
    
  3. or download this
    my @b = foo { $_ = shift; $_ ** 2 } @a;
    my @b = foo { my $var = shift; $var ** 2 } @a;
    
  4. or download this
    #!/usr/bin/env perl
    use 5.010;
    ...
    
    my @a = ( "1", "2", "3", "4", );
    my @b = foo { $_ ** 2 } @a;