Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Counting unique(ish) elements in a hash

by hdb (Monsignor)
on Aug 30, 2013 at 10:32 UTC ( [id://1051591]=note: print w/replies, xml ) Need Help??


in reply to Counting unique(ish) elements in a hash

As you have not given us a correct Perl structure for your data, a complete answer cannot be given. However, the code could look something like the one below, where you need to enter the correct pieces to loop over the entries under your keys yourself (replacing the ... with the appropriate (nested) loop).

for my $name ( keys %hash ) { my $count = 0; for my $entry ( ... ) { # loop over entries under first key $count++; print "$name $entry $count\n"; } }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (5)
As of 2024-04-24 21:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found