>perl -wMstrict -le "my $max_x = 99; ;; for $max_x (0 .. 5) { print $max_x; last if $max_x == 2; } ;; print qq{max_x: $max_x}; " 0 1 2 max_x: 99 #### >perl -wMstrict -le "my $x = 'foo'; print qq{x before loop: '$x'}; ;; for $x (0 .. 2) { func(); our $y; print qq{$x, $y}; } ;; print qq{x after loop: '$x'}; sub func { our $x; our $y; $x = 99; $y = 42; } " x before loop: 'foo' 0, 42 1, 42 2, 42 x after loop: 'foo' #### >perl -wMstrict -le "our $max_x = 99; ;; for my $max_x (0 .. 4) { func(); print $max_x; last if $max_x == 2; } ;; print qq{max_x after loop: $max_x}; ;; sub func { $max_x = 42; } " 0 1 2 max_x after loop: 42