Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: do-until: Can't "next" outside a loop block.

by 2teez (Priest)
on Nov 26, 2012 at 06:10 UTC ( #1005570=note: print w/ replies, xml ) Need Help??


in reply to do-until: Can't "next" outside a loop block.

Hi humble,

if you check do documentation, you will notice this:
"do BLOCK" does *not* count as a loop, so the loop control statements "next", "last", or "redo" cannot be used to leave or restart the block.
check this perlsyn for alternative strategies.

Update:
However, If you must use the do as stated in your code with next, then you have to "double" the braces like so:

do{{ next .... }} until ...;
Please see perlsyn for more.

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me


Comment on Re: do-until: Can't "next" outside a loop block.
Download Code
Re^2: do-until: Can't "next" outside a loop block.
by humble (Acolyte) on Nov 30, 2012 at 04:57 UTC
    Can not to say anything but WOW! Thank You very much, 2teez!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2015-07-06 21:28 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 (83 votes), past polls