foreach my $i (0 .. 2) { push @d, sub { print "$i\n" }; }