Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^3: arrays: shifting in while loop

by AnomalousMonk (Abbot)
on Mar 07, 2012 at 15:17 UTC ( #958305=note: print w/ replies, xml ) Need Help??


in reply to Re^2: arrays: shifting in while loop
in thread arrays: shifting in while loop

... the while-loop EXPR [is] re-evaluated after each iteration...

It is, but I was trying to make a (perhaps rather trivial) point with regard to continued execution of the loop body (which I've tried to clarify in the original reply) as exemplified below.

>perl -wMstrict -le "my @ra = (9, 8, 7); ;; while (@ra) { print 0+@ra, ' in @ra'; shift @ra; print 0+@ra, ' in @ra'; shift @ra; print 0+@ra, ' in @ra'; shift @ra; print 0+@ra, ' in @ra'; shift @ra; print 0+@ra, ' in @ra'; shift @ra; print 0+@ra, ' in @ra'; } " 3 in @ra 2 in @ra 1 in @ra 0 in @ra 0 in @ra 0 in @ra


Comment on Re^3: arrays: shifting in while loop
Download Code
Re^4: arrays: shifting in while loop
by repellent (Priest) on Mar 07, 2012 at 17:07 UTC
    Great, I knew I missed something from your original post.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (7)
As of 2015-07-03 23:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls