|Syntactic Confectionery Delight|
How to pass a variable to function selected from a hashby cat2014 (Monk)
|on Jan 18, 2001 at 04:12 UTC||Need Help??|
cat2014 has asked for the
wisdom of the Perl Monks concerning the following question:
I'll start by saying that I have absolutely no idea what this thing that I'm calling a decision hash actually is. That aside, I've got a hash constructed which has strings as keys & function calls as values. I'm using it as a case statement- calling the hash with some value that will match a key so that a function will be run on the input that I'm providing.
My problem is with how to get something to be passed into the selected function. It looks like whatever i pass in is turned into "1" -but you can return whatever you want. Am I totally wasting my time getting this to work, or is there actually someway to set up a hash to have a value passed in & run a function on it?
here is the output:
I'm *really* hoping that someone will just tell me that i'm overlooking something incredibly obvious here.