in reply to Re: A few random questions from Learning Perl 3
in thread A few random questions from Learning Perl 3
Excellent answer, with one small adjustment to the last example to do with redo ..
my $flag = 0; foreach (1..10) { print("$_ "); if ($_ == 9 && $flag != 1) { $flag=1; redo; } }
I have initialized flag to zero at the beginning of the loop. This was, of course, understood :) by all readers, but for the newcomer, it might be helpful.
--t. alex
|
---|