> Steve Bertrand wrote:
>> I got it...
>>
>> for my $item (@clean) {
>>         if (! grep ($_ eq $item, @array)) {
>>                 push (@array, $item);
>>                 print "$item\n";
>>         }
>> }
>
> FWIW, this is a FAQ (see "perldoc -q duplicate"). If the array
> elements can
> be compared with string semantics (as you are doing here), the
> following
> will work:
>
>    my @array = do { my %seen; grep !$seen{$_}++, @clean };

Thank you for the info...but pardon my ignorance. I'd just like to
understand what is happening there. Is grep adding to the array the
keys in the hash that have values that have not been incremented?

Thanks,

Steve

>



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to