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


in reply to Printing an array using while loop

my $item; while (defined($item = shift @array)){ print $item, "\n"; }

This destroys @array, though.

BTW there is no PERL, just perl (the interpreter) and Perl (the language)

Update: made 0-safe