Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: returning to the outer loop

by GrandFather (Saint)
on Sep 21, 2018 at 02:26 UTC ( [id://1222777]=note: print w/replies, xml ) Need Help??


in reply to Re^2: returning to the outer loop
in thread returning to the outer loop

I somewhat agree that early exits using named blocks has a place. However there is very often benefit in terms of understanding the intent of code from wrapping "complicated" stuff up in a sub. The immediate benefit is that you can understand the surrounding code providing a context for a chunk of named work. If the name is good understanding both the calling context and the called code should be easier and you don't have to understand everything at the same time.

So, a small part of my reply is "don't use goto", but most of it is "refactor into simple digestible chunks".

Optimising for fewest key strokes only makes sense transmitting to Pluto or beyond

Replies are listed 'Best First'.
Re^4: returning to the outer loop
by Laurent_R (Canon) on Sep 21, 2018 at 08:00 UTC
    I definitely agree with you that using a sub and a return statement often makes things clearer than named blocks with other flow control statements. I just don't want to dogmatically reject the next, last and continue control flow statements, as they can offer a good and simple way of finely-tuned control flow.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-24 06:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found