Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Perl Best Practices - Loop Labels

by Anonymous Monk
on Apr 16, 2020 at 20:07 UTC ( #11115648=note: print w/replies, xml ) Need Help??


in reply to Perl Best Practices - Loop Labels

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: Perl Best Practices - Loop Labels
by Your Mother (Archbishop) on Apr 16, 2020 at 20:17 UTC

    Maybe you could show some code demonstrating your point or clarify this, nothing is truly structural, everything executes, or show something, anything, worth reading. I am personally in accord with some of the best programmers at the monastery who already answered: loop labels can be nice, elucidating even, as long as they are only a couple—three would be my limit before biting the refactoring bullet—deep.

Re^2: Perl Best Practices - Loop Labels
by haukex (Bishop) on Apr 16, 2020 at 20:43 UTC
    To me, "loop labels are GOTOs." ... "Best practice?" Stomp them out!

    I realize I'm responding to a troll, but this is just way too wrong. Yes, one can write bad code in any language. But labels applied to loops and blocks are the solution to avoid gotos. Just one example, compare the code in this node to the one in my reply.

Re^2: Perl Best Practices - Loop Labels
by BillKSmith (Prior) on Apr 17, 2020 at 03:32 UTC
    If you find the deeply nested 'if blocks' usually needed to replace 'next' or 'last' are easier to maintain, use them - always! Personally, I strongly prefer 'next' and 'last'. The issue of labels is much less clear.
    Bill

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2021-05-07 11:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (91 votes). Check out past polls.

    Notices?