B
Bart Van der Donck
Hello,
I am trying to catch a hash in its original form in a subroutine,
between other variables.
my $a1 = 'str1';
my %b = ( '1' => 'a', '2' => 'b' );
my $a2 = 'str2';
show($a1, %b, $a2);
sub show {
print $_[2];
}
I expected this to print 'str2', and $_[1] to become a reference to
%b, but it appears @_ holds every single value of the hash in a simple
array. Is there a way to receive "clean" hashes in this subroutine ? $_
[#$_] works in my particular case, but I don't know the length of %b
and the eventual production code will have more hashes to pass, which
I should correctly refer to.
Thanks for any ideas,
I am trying to catch a hash in its original form in a subroutine,
between other variables.
my $a1 = 'str1';
my %b = ( '1' => 'a', '2' => 'b' );
my $a2 = 'str2';
show($a1, %b, $a2);
sub show {
print $_[2];
}
I expected this to print 'str2', and $_[1] to become a reference to
%b, but it appears @_ holds every single value of the hash in a simple
array. Is there a way to receive "clean" hashes in this subroutine ? $_
[#$_] works in my particular case, but I don't know the length of %b
and the eventual production code will have more hashes to pass, which
I should correctly refer to.
Thanks for any ideas,