use 5.030; use warnings; my @subrefs; my $i = 0; for (1..3) { push @subrefs, sub { print ++$i }; } for (@subrefs) { $_->(); }