Mmhh, I know this is just copy and pasted code, but it makes me wonder anyway - is it just me or is the code for the last example slightly strange?
in reply to Re: last in a do while loop
in thread last in a do while loop
last if $x = $y**2;
# do something here
} while $x++ <= $z;
- if $x = $y**2; why choose a confusing assignment instead of a normal comparison?
- Why not the explicit last LOOP? I know that it works here without it all right but I don't see the benefit of labelling the block without using the label afterwards
Code written by Hofmator and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.