in reply to Passing Reference of a Hash to a method
Your variable $hRef will contain the value '1'.
You are evaluating an array (@_) in scalar context, which returns the number of elements in the array (in this case, 1).
To get round this, either extract a useful scalar from @_ using one of these approaches:
my $hRef = shift; my $hRef = $_[0];
Or change the assigment to a list assignment:
my ($hRef) = @_;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|