Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
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?
[zentara]: Strange, on clicking a link in a node, I am taken to that node, but my votes and login are lost. Should I post a Permonks Discussion?

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (3)
As of 2017-05-26 12:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?