Perl Reference to a Hash

Google+ Pinterest LinkedIn Tumblr +

\n”;

my %ha = (Apple => “purple”, Banana => “yellow”, Pear => “green”, Lemon => “green”);
my $href = \%ha;
print $$href{‘Apple’} . “

my $haref = {Apple => “purple”, Banana => “yellow”, Pear => “green”, Lemon => “green”};
print $haref->{‘Banana’};

print “

Share.

About Author

Leave A Reply