foreach (0, 1) { my $i = $_; sub my_print () { print $i; } my_print; } [download]
In reply to foreach-loop-local var in sub by warshall