{ my $todo; foreach my $elt (0..2 ) { $todo->() if $todo; $todo = sub { print "$elt\n" }; } }