in reply to passing hash to subroutine
You're kinda mixing up pass by value and pass by reference.
If you want to pass by value, then</strike
In the method being invoked, you need to capture all the passed values, not just the the first one:
but you'd probably be better of using a reference:chargeCard( %_billingInfo ); ... sub chargeCard { my %_billingInfo = @_; $_billingInfo{key} }
chargeCard( \%_billingInfo ); ... sub chargeCard { my $_billingInfo = shift; $_billingInfo->{key}; }
update: Remove the whole passed by value/by ref. ikegami reminded me perl always passes by value and I was confusing *pass by reference* with *passing a reference.*
|
|---|