Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: My very confusing questionsby perlfan (Vicar) |
on Jul 08, 2014 at 14:18 UTC ( [id://1092729]=note: print w/replies, xml ) | Need Help?? |
You are confused because of things that implied in Perl.
Let's back up. You are treating your hash of subroutines like an array of subroutine references. Do you mean to do the following? You Then would selectively call the sub you want using using the subroutine reference invocation idiom,
Assuming you do, then the shift operates on @_ - this is the implicit parameters list. For clarity, it is recommended that you unpack parameters, for example: More about shift and why it's used inside of subroutines to unpack parameters:
But of course, TIMTOWTDI. Some examples: Pass in some number of key/value pairs as a simple list As a singular hash reference with some number of key/value pairs already defined I HTH.
In Section
Seekers of Perl Wisdom
|
|