Welcome to the Monastery | |
PerlMonks |
Re: Syntax explanation requiredby LanX (Saint) |
on Jan 02, 2013 at 12:35 UTC ( [id://1011259]=note: print w/replies, xml ) | Need Help?? |
> my @uniq = keys %{ {%hash1, %hash2} }; From inside out: - First the two hashes are flattened to lists, which are combined to a long list. - Building a new (anonymous) hashref will eliminate duplicated entries from that hash ¹ - To be able to extract² the keys you still need to dereference this ano-hashref with %{..}. step by step:
Cheers Rolf UPDATES: ¹) because repeated keys will be overwritten. ²) at least with older perl-versions, see Athanasius' remark
In Section
Seekers of Perl Wisdom
|
|