In, my $hRef=@_; you're forcing @_ into scalar context, yielding count of its elements. As called, that is 1, and ref(1) gets you undef.
Fix this by making the assignment happen in list context:
sub traverseHash { my ($hRef) = @_; print ref($hRef); }
After Compline,
Zaxo
In reply to Re: Passing Reference of a Hash to a method
by Zaxo
in thread Passing Reference of a Hash to a method
by piyush.shourie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |