More likely than not there is a problem with the way your code is written, the code you want to run just once should probably be outside of the loop.
Anyway, as a duct-tape kinda fix you can always do:
my $done_sort=0; # or some more meaningful name while( $cond) { # probably some code here unless( $done_sort) { sort_the_array( @array); $done_sort=1; } # more code here }
But there is probably a better way, which I can't find unless I see the code.
In reply to Re: Breaking a Loop
by mirod
in thread Breaking a Loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |