Nov 052010
Pass hash as reference in Perl
Answer:
In the previous post, we talked about how to Pass hash as list in Perl, now we discuss another way: To pass a hash as a reference in Perl function.
sub foo {
my ($h) = @_;
print $h->{"1"};
}
foo ( {"1" => "One", "2" => "Two"} );
One will be printed out.