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

Re: Using Shift with Parameters in a subroutine

by Jim (Curate)
on Oct 20, 2014 at 17:12 UTC ( #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
Node Status?
node history
Node Type: note [id://1104465]
help
Chatterbox?
and the web crawler heard nothing...

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










    Results (142 votes). Check out past polls.

    Notices?