jeudi 29 mai 2014

Selecting Multiple %Hash Elements Using @Array in Perl


Vote count:

0




How does one create a new hash using an array of keys on an existing hash?



my %pets_all = (

'rover' => 'dog',
'fluffy' => 'cat',
'squeeky' => 'mouse'
);

my @alive = ('rover', 'fluffy');

#this does not work, but hopefully you get the idea.
my %pets_alive = %pets_all{@alive};


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire