[EMAIL PROTECTED] wrote:
> I need to test if an array holds duplicates, and if so do something.
If you just need to check for the presence of a duplicate, something like
this will do the trick:
sub has_dup { my %seen; $seen{$_}++ && return 1 for @_; }
Of course, all the hash-based methods depend on uniqueness being determined
by the stringified version of the array elements.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>