Help for this page

Select Code to Download


  1. or download this
    my $x; BEGIN { $x = 0 }
    my $f = sub { $x };
    ++$x;
    print $f->();
    
  2. or download this
    for (1..2) {
        my $x = $_;
        print sub { $x }->();
    }