Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

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

by hdb (Monsignor)
on Mar 21, 2018 at 08:37 UTC ( #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? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-05-16 19:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (63 votes). Check out past polls.

    Notices?