Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Print keys corresponding to duplicate values

by tangent (Vicar)
on Apr 27, 2016 at 23:29 UTC ( #1161711=note: print w/replies, xml ) Need Help??


in reply to Print keys corresponding to duplicate values

As FreeBeerReekingMonk suggests, the %seen style of hash is often used for counting duplicates:
my %seen; $seen{$_}++ for values %hash; my @dups = grep { $seen{ $hash{$_} } > 1 } keys %hash; print join(',', sort @dups );

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1161711]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2022-05-17 17:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (68 votes). Check out past polls.

    Notices?