Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Why does a full iteration over array & shift is not emptying the array

by rubasov (Friar)
on May 04, 2010 at 14:26 UTC ( #838318=note: print w/replies, xml ) Need Help??


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'; }
  • Comment on Re: Why does a full iteration over array & shift is not emptying the array
  • Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://838318]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2016-09-29 08:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (550 votes). Check out past polls.