![]() |
|
Perl Monk, Perl Meditation | |
PerlMonks |
Re^2: Don't print on the last loopby calin (Deacon) |
on Jun 13, 2005 at 20:20 UTC ( [id://466282]=note: print w/replies, xml ) | Need Help?? |
Another idea is to unroll the first iteration of the loop. This way you don't have to test for a flag on subsequent iterations. I believe this is the correct approach optimisation-wise - if one condition is true only once and then guaranteed false for the next 1.000.000 times, checking it programatically (and doing other stuff like modifying the flag variable) 1.000.001 times is a waste. Pseudocode:
In Section
Seekers of Perl Wisdom
|
|