Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Use of 'last' within single-line while loops

by hdb (Monsignor)
on Mar 21, 2018 at 08:37 UTC ( [id://1211399]=note: print w/replies, xml ) Need Help??


in reply to Use of 'last' within single-line while loops

In my humble opinion I would suggest the use of labels with last and next in the case of nested loops to make sure the reader of the code (if not the Perl interpreter) is not confused about the intended logic.

use strict; use warnings; OUTER: while( 1 ) { last OUTER while (1); print "Done with INNER.\n" } print "Done with OUTER.\n"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found