Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Aug 262010

Hash reference in Perl


Hash reference is something like a pointer to a hash data structure in Perl


my %hash = (
        "a" => "1",
        "b" => "2",

my $hash_ref = \%hash;

$hash{"a"} = "A";

print $hash_ref->{"a"}; # print out "A" as change in  %hash  also reflected in its reference

  One Response to “Hash reference in Perl”

  1. Stumbled throughout from google, and read your excellent post

 Leave a Reply



You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>