Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Occurence List

by aitap (Deacon)
on Oct 10, 2012 at 17:55 UTC ( #998276=note: print w/replies, xml ) Need Help??


in reply to Occurence List

Use a hash:
use Data::Dumper; my @list = qw/ 1 1 1 234 234 3 5 5 2 7 6 3 6 8 4 /; my %count; $count{$_}++ foreach @list; print Dumper \%count; __END__ $VAR1 = { '6' => 2, '3' => 2, '234' => 2, '7' => 1, '2' => 1, '8' => 1, '4' => 1, '1' => 3, '5' => 2 };
Sorry if my advice was wrong.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://998276]
help
Chatterbox?
[ambrus]: Corion: um, that was me (duh)
[ambrus]: I just can't get you two to cooperate directly because schmorp doesn't want to be in the chatterbox
[ambrus]: maybe you should join his irc channel or something, unless that causes a flame blowup

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2016-12-09 14:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (151 votes). Check out past polls.