Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Perl Best Practices - Loop Labels

by Anonymous Monk
on Apr 17, 2020 at 02:39 UTC ( #11115662=note: print w/replies, xml ) Need Help??


in reply to Perl Best Practices - Loop Labels

If any "future someone," looking upon what appears to him to be a simple nested loop, cannot immediately detect that there are "next LABEL" and/or "last LABEL" constructions ... somewhere(!) anywhere(!!) else ... which materially affect what he sees, then "you have a problem." Code such as this is quite possibly worse than a GOTO. If it merely occurs within a couple pages of source-code it might still be debuggable. But if it is at all possible to rewrite this code I would do so at once.

Replies are listed 'Best First'.
Re^2: Perl Best Practices - Loop Labels
by haukex (Bishop) on Apr 17, 2020 at 10:05 UTC
    "next LABEL" and/or "last LABEL" constructions ... somewhere(!) anywhere(!!) else ... Code such as this is quite possibly worse than a GOTO.

    Again, that's FUD, and "anywhere" is plain wrong. If one sees either a label on a loop/block or next/last/redo LABEL, then that label is quickly found via a search, and unlike goto, one knows which scope the label has to be in ("Exiting subroutine via next/last" are important warnings).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2020-09-26 15:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (141 votes). Check out past polls.

    Notices?