On Jan 20, 2013, at 6:06 AM, David Precious <[email protected]> wrote:
> On Sat, 19 Jan 2013 19:43:15 -0800 > Jim Gibson <[email protected]> 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: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
