in reply to Why does a full iteration over array & shift is not emptying the array
Another way to do it (this won't fail if your array contains undefs):
my @a = ( 1 .. 4, undef, 6 .. 10 ); while (@a) { my $x = shift @a; say defined $x ? $x : 'undef'; }
|
---|
In Section
Seekers of Perl Wisdom