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

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

Hi Monks,

Could you tell me how can I fetch array of values from hashref in single instruction? Thanks.

my @a = qw/c b d/; my %h = ( a => 4, b => 3, c => 2, d => 1, ); my @b = @h{@a}; # this one works as expected print "2 3 1\n", Dumper(\@b), "\n"; my $h = \%h; my @c = @{%$h}->{@a}; # this one fails, what is the correct syntax? print "2 3 1\n", Dumper(\@c), "\n";