Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: Perl 'grammar'

by WoodyWeaver (Monk)
on Jan 10, 2008 at 18:42 UTC ( [id://661698]=note: print w/replies, xml ) Need Help??


in reply to Re^5: Perl 'grammar'
in thread Perl 'grammar'

Me too. That must mean its a "best practice". :-)

However, when unpacking the passed args into named variables, there is often some cleanup that needs to be done, such as assigning defaults for unpassed values, sanitizing, etc. I would tend to classify breaking "last, first" into "last", "first" as part of that 'throw into named variables' phase rather than the 'guts' phase, where you are making meaningful changes or performing analysis.

I'm kinda weak about the last part, though. Sometimes I tend to return early, if I can determine what I'm going to send back from the subroutine. Screws up debugging, though. Use of your three part strategy means that one can put a print just before the final return, and gain insight into what the sub is really doing.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2024-04-23 22:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found