use strict; use warnings; my @x = (0, 1, 2, 3); my $next; my $first = pop @x ; print "x $#x pop ",$first,"->"; while ( $next = pop @x ) { print ",",$next } print "\n"; @x = (0, 1, 2, 3); $first = pop @x ; print "x $#x pop ",$first,"->"; while ( defined ($next = pop @x) ) { print ",",$next } print "\n";