Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^3: How to get Keys from hash having same value?

by targetsmart (Curate)
on Jun 03, 2008 at 13:22 UTC ( #689875=note: print w/replies, xml ) Need Help??


in reply to Re^2: How to get Keys from hash having same value?
in thread How to get Keys from hash having same value?

I tried doing that, It is working.
use Data::Dumper; %myhash = ( 1 => 'a', 2=> 'b', 3=> 'a', 4=>'c', 5 => 'a', 6 => 'a', 7 +=>'b'); %newhash = map { ($_,$myhash{$_}) } grep { $myhash{$_} eq 'a'; } keys + %myhash ; print Dumper \%newhash;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2020-11-25 03:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?