[kw-pm] unique

Dave Carr dc0955 at gates.com
Wed Apr 19 04:22:50 PDT 2006


Found this snippet to do unique on a sorted array

 

$prev = 'nonesuch';

@uniq = grep($_ eq $prev && (($prev) = $_), @sorted);

 

How could I modify this to require a string to occur at least two times
to be included in the output array, in other words single occurrences
will be skipped?

 

- Lloyd

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.pm.org/pipermail/kw-pm/attachments/20060419/c1232890/attachment.html 


More information about the kw-pm mailing list