http://www.perlmonks.org?node_id=545243

gube has asked for the wisdom of the Perl Monks concerning the following question:

Hi monks,

I have a doubt in getting values in hash reference. Please see my by below code and comment and give me pour some idea about the code. I cannot understand this code, how it's working please some one give me an idea

"print @$hash_ref{'a', 'b'};"
#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; #Hash my %hash = ('a' => 1, 'b' => 2); #To print the two values i have mentioned keys print @hash{'a', 'b'}; #Hash Reference my $hash_ref = \%hash; #To print the two values i have mentioned keys i am getting error (Glo +bal symbol "@hash_ref" requires explicit package name) print @hash_ref->{'a', 'b'}; #Prints values without error print @$hash_ref{'a', 'b'};