Good question. The others explained it well already but here is another hint. (You weren't actually passing a reference is why it didn't work.)
use strict; use warnings; my $data = {status=>"ok",'message-type'=>"member",'message-version'=>" +1.0.0"}; my $result_hr; ref($result_hr) ? print "ref($result_hr)\n" : print "\$result_hr is no +t a reference.\n" ; $result_hr = {}; ref($result_hr) ? print "ref($result_hr)\n" : print "\$result_hr is no +t a reference.\n" ; __DATA__ $result_hr is not a reference. ref(HASH(0x3ddb70))
In reply to Re: passing a hash ref in a sub
by Lotus1
in thread passing a hash ref in a sub
by frazap
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |