http://www.perlmonks.org?node_id=646327


in reply to Printing an array using while loop

or:
my @array1 = qw/ball bat helmet/; while (@array1) { my $item = pop @array1; print $item; push(@array2,$item); }
That is if you care about keeping the original contents - otherwise:
my @array1 = qw/ball bat helmet/; while (@array1) { print pop @array1; }