in reply to to count the number of occurence of a number
Now you can just print out what you've got.my %frequency; while(<>) { my @column = split ' ' or next; $frequency{$column[2]}++; }
Here's the result I got from your sample:{ local($\, $,) = ("\n", "\t"); # tab delimited output foreach (sort { $frequency{$b} <=> $frequency{$a} || $a <=> $b } k +eys %frequency) { print $_, $frequency{$_}; } }
35324 4 33227 3 33308 2 33011 1 35537 1 35606 1
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: to count the number of occurence of a number
by extrem (Initiate) on Sep 28, 2011 at 11:05 UTC | |
by reisinge (Hermit) on Sep 28, 2011 at 12:29 UTC | |
by extrem (Initiate) on Sep 28, 2011 at 13:54 UTC |