|
|
| Keep It Simple, Stupid | |
| PerlMonks |
Re: Parameters, subs and the shift functionby edan (Curate) |
| on Aug 19, 2003 at 07:15 UTC ( [id://284853]=note: print w/replies, xml ) | Need Help?? |
This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.
You went to the trouble of writing some nice test code, but did you run it? It might help answer some of your questions... First, shift only takes one element off the parameter list, so your test sub will give you:
As for how the arguments are passed to the function, perl flattens out the argument list, so it will arrive as one big list (@_ to be exact), and you won't be able to tell where one list end and another begins. If you need to do this, you'll have to pass references, like so:
HTH --3dan
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||