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. }

Sanity? Oh, yeah, I've got all kinds of sanity. In fact, I've developed whole new kinds of sanity. You can just call me "Mister Sanity". Why, I've got so much sanity it's driving me crazy.