my @l = (1, 2, 3, 0, 5, 6); while (my $x = shift @l) { print "$x "; } ## OUTPUT ## 1 2 3