in reply to Re^6: loop surprise
in thread loop surprise
I can remember that long time (say: 30 or more years) ago, I also wrote loops like that.
But now that you mention it, and thinking about it, I notice always write those kind of loops like:
my $interesting_index= 'not existing'; for ($i=1; $i<=10; ++$i) { next unless &condition($i); $interesting_index= $i; last; } # spit an error if $interesting_index is still 'not existing'
The reason behind this is simply that your loop might not have found a valid value.
s$$([},&%#}/&/]+}%&{})*;#$&&s&&$^X.($'^"%]=\&(|?*{%
+.+=%;.#_}\&"^"-+%*).}%:##%}={~=~:.")&e&&s""`$''`"e
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^8: loop surprise
by Marshall (Canon) on Apr 04, 2018 at 17:59 UTC |
In Section
Seekers of Perl Wisdom