If he just wants to count dupes, couldn't he just sort then use something like
foreach $value(@list) { $count{$value}++; if ($value ne $lastvalue && $count{$value}>1) {print $count{$value}."\n"} $lastvalue=$value; } Regards, Agustin Rivera Webmaster, Pollstar.com / PollstarOnline.com ----- Original Message ----- From: "Elias Assmann" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: "Craig Hammer" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Thursday, May 23, 2002 9:51 AM Subject: RE: uniq > On Thu, 23 May 2002, Jeff 'japhy' Pinyan wrote: > > > On May 23, Craig Hammer said: > > > > >Very nice explanation. One thing though, I am not using uniq to remove > > >duplicates. I am using it to get a count of duplicates. In my case, I am > > >creating a threshhold to determine when someone (malicious) is scanning my > > >address ranges. > > > > Ah, I see. Well then, you can use either method to obtain the count: > > > > # a -- from perlfaq4 > > my $prev = "NO_SUCH_VALUE"; > > my $dup = 0; > > my @sorted = grep { $_ ne $prev ? $prev = $_ : ++$dup } sort @records; > > Correct me if I'm wrong, but I don't think this does what Craig wants, > since $dup would end up containing all the values of %seen from b) > added up, with no indication of how many values were seen more than > once, how often each of these was seen or what those values were (all > of which I assume to be interesting in this case). > > Elias > > -- > "There are people who don't like capitalism, and there are people who don't like PCs, > but there's no one who likes the PC who doesn't like Microsoft." > -- Bill Gates > > > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]