when you're reading the data, create a hash such that each value is 
incremented when more than one instance is read.  what happens is that key 
value pairs are "values and counts' of each value.


my %foo = ();

# read data
#
$foo{$data]++;   #count data.  new values = 1, previously read values are 
incremented by 1

good luck

At 03:36 PM 6/11/02 +0800, Chang Ming Huei wrote:
>Hi,all
>
>If I have a set of data as following:
>
>aa
>aa
>aa
>bb
>bb
>cc
>
>To count  the repeated data, I can use
>cat xxx.dat | uniq -c
>
>It can get the result
>3 aa
>2 bb
>1 cc
>
>But how to do it use perl ?


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to