Since grep only cares if the expression evaluates true or false, the $_ in second version is superfluous, but it may be the easiest to read and understand. If you want to find unique values and keep a count of how many times something has been seen, then you can do something like:
$seen{$_}++ foreach @array; my @unique = keys %seen; while ( ($k, $v) = each %seen ) { print "$k was seen $v times\n"; } # or if you want them sorted foreach (sort @array) { print "$_ was seen $seen{$_} times\n"; } HTH, -- jay **************************************************** >From this code: my %counters = (); $counters{$_} += 1 for @not_uniq_array; print "elements\t", (join "\t", %counters); __END_CODE__ What if I need to know the element index #? _________________________________________________ This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited. Dansk - Deutsch - Espanol - Francais - Italiano - Japanese - Nederlands - Norsk - Portuguese - Svenska: www.cardinalhealth.com/legal/email -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>