in reply to how can i return the common keys from a hash
Use another hash to count the keys: (Corrected: Pre- not post-increment)
%h= 1..10; %i = 1.. 20; %j = 3..8; %k = 9 .. 18;; %l = 1 .. 14;; %x = ();; print grep{ ++$x{ $_ } == 2 } sort{ $a <=> $b } map{ keys %$_ } \( %h, %i, %j, %k, %l,);; 1 3 5 7 9 11 13 15 17
|
|---|