- or download this
for (my $i = 0; $i<3; $i++) {
my $str = "$i\n";
push @d, sub { print $str };
}
- or download this
for (my $i = 1; $i<=3; $i++) {
my $str = "$i\n";
push @d, sub { print $str };
}
- or download this
for my $i (1..3) {
my $str = "$i\n";
push @d, sub { print $str };
}