Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Printing an array using while loop

by perlfan (Curate)
on Oct 21, 2007 at 22:52 UTC ( #646327=note: print w/replies, xml ) Need Help??


in reply to Printing an array using while loop

or:
my @array1 = qw/ball bat helmet/; while (@array1) { my $item = pop @array1; print $item; push(@array2,$item); }
That is if you care about keeping the original contents - otherwise:
my @array1 = qw/ball bat helmet/; while (@array1) { print pop @array1; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2019-08-25 20:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?