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

how to pass array values as keys to hash.Using those keys i want to find out values in hash.Can you please help me how to find out values for specific dara in array.I will pass array values as keys in hash

Iam having 2 hashes and 1 array @array={key1', 'another_key'}; ; another one my %entries= ( 'key1' => 'number one', 'another_key' => '2', 'the third' => "three's a crowd", ); So in this i have to find the values for @array keys.Not all the values in hasg it should give me numberone and 2 as output
  • Comment on How to pass array values as input to Hash keys

Replies are listed 'Best First'.
Re: How to pass array values as input to Hash keys
by LanX (Saint) on Feb 08, 2015 at 15:42 UTC
Re: How to pass array values as input to Hash keys
by Corion (Patriarch) on Feb 08, 2015 at 10:24 UTC

    Your question is highly unclear. Please provide some code that shows what you are trying to do.

    As a start, maybe the following does what you need?

    my @list= ('key1', 'another_key', 'the third'); my %entries= ( 'key1' => 'number one', 'another_key' => '2', 'the third' => "three's a crowd", ); print $entries{ $list[ 2 ] };
Re: How to pass array values as input to Hash keys
by pme (Monsignor) on Feb 08, 2015 at 16:13 UTC