Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Using Shift with Parameters in a subroutine

by Jim (Curate)
on Oct 20, 2014 at 17:12 UTC ( [id://1104465]=note: print w/replies, xml ) Need Help??


in reply to Using Shift with Parameters in a subroutine

It would only seem rational that we have a way to [condense argument passing], especially if i am passing 10 references to my subroutine. … I see there is no formal parameter support, at least in perl 5.10.1 (which is my customer version).

The Perl Best Practice titled "Named Arguments" applies in the case you describe:  "Use a hash of named arguments for any subroutine that has more than three parameters."

This Best Practice is in Chapter 9, Subroutines, which is available online here:  http://oreilly.com/catalog/perlbp/chapter/ch09.pdf. "Named Arguments" is on pp. 182-3.

  • Comment on Re: Using Shift with Parameters in a subroutine

Replies are listed 'Best First'.
Re^2: Using Shift with Parameters in a subroutine
by perlron (Pilgrim) on Oct 21, 2014 at 17:30 UTC
    thanks Jim. that's definitely a case in point then.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2024-04-23 09:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found