My understanding is that the while will execute so long as there are elements in @a...
ivanthemad: I expect you already understand the following point perfectly well, but I want to dispell my sneaking suspicion of a possible misapprehension on your part.
The while-loop in the example code will only begin execution (Update: of
a loop) if the array is non-empty. However, (Update: once begun) loop execution will continue regardless of the state of the array unless an explicit loop exit is made conditional upon array state, e.g., with a statement like last unless @a;.
Update: Clarified (hopefully) pertinence to loop body per repellent.