in reply to process array with while loop
There is a case where you would use a while loop to process an array, but it's the situation wherein you are removing element(s) from the array as part of the processing and wish to continue as long as the array still has any contents:
while (@array) { my $elem = pop @array; # or shift, to take from the front end # Do stuff with $elem here. }
|
|---|