in reply to scalar out of a loop
c:\@Work\Perl\monks>perl -wMstrict -le "my $done = 'got stuff to do'; print qq{'$done'}; ;; for my $i (1 .. 4) { print $i; if ($i == 2) { $done = 'finished'; last; } } print qq{'$done'}; " 'got stuff to do' 1 2 'finished'
Note that you need to execute last after setting ('exporting') the $done flag, not before as in your most recently posted originally posted code.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: scalar out of a loop
by mitchreward (Acolyte) on Jul 21, 2014 at 15:50 UTC |