FWIW, adding an empty list also makes a copy of the elements (on the internal stack) to iterate over:
for my $x ((), @arr) { ... }
In reply to Re^2: Why does a full iteration over array & shift is not emptying the array
by almut
in thread Why does a full iteration over array & shift is not emptying the array
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |