On Jan 20, 2013, at 6:06 AM, David Precious <dav...@preshweb.co.uk> wrote:

> On Sat, 19 Jan 2013 19:43:15 -0800
> Jim Gibson <jimsgib...@gmail.com> wrote:
> 
>> Use a hash to count the number of times each item appears in the
>> array:
>> 
>> my %counts;
>> $counts{$_}++ for @my_array;
>> 
>> Then, extract the keys the have a count of 1:
>> 
>> my @new_array = map { $counts{$_} == 1 } keys %counts;
> 
> Yep, that's how I'd do it, but you meant grep, not map :)


Yes, I did. Thanks for the correction! 

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to