in reply to Why does a full iteration over array & shift is not emptying the array
my @a = ( 1 .. 4, undef, 6 .. 10 ); while (@a) { my $x = shift @a; say defined $x ? $x : 'undef'; } [download]