Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Exiting eval via next: is that so bad?

by bluto (Curate)
on Aug 14, 2001 at 19:39 UTC ( [id://104810]=note: print w/replies, xml ) Need Help??


in reply to Exiting eval via next: is that so bad?

The canonical way of getting out of an eval block is to raise an exception with 'die'. If you really want to use 'next', you could try to add another level of braces so that it can jump out of a "real" block. For example...
eval {{ next; }}
... doesn't issue a warning (and doesn't do anything useful either). Even in this case I'd probably use 'last' instead since it implies you are finished doing whatever you were doing in the block, but YMMV.

bluto Update: Ok, I'm a slow typer so this is redundant. Think about using 'die' instead though.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found