Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Find number of unique values in hash

by CountZero (Bishop)
on Jan 19, 2010 at 22:07 UTC ( [id://818306]=note: print w/replies, xml ) Need Help??


in reply to Find number of unique values in hash

You will need to employ some form of loop, but why shouldn't you? It can be as easy as:
$ages{$_->{'age'}}++ foreach values %hoh;
And you will find the number of children with the same age as the values keyed by the age in the hash %ages:
{ 11 => 2, 12 => 2, 13 => 1 }

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found