> sub in_a_not_b {
> my ( $ra , $rb , %u , %v ) = ( $_[0] , $_[1] , () , () ) ;
> grep { $_ and ! ($u{$_}++) } @$rb ;
> grep { $_ and ! ($v{$_}++) and ! $u{$_} } @$ra ;
> }
Hey have we changed into the "perl haxors" list ??
If the spec is "list of unique (ie duplicates removed) items in @a that aren't
in @b", then I'd suggest
sub in_a_not_b
{
my ($ra , $rb) = @_ ;
my %seen = map(($_ => 1), @{$rb});
return grep(++$seen{$_} == 1, @{$ra});
}
Reads more like what it does to my mind, but YMMV of course...
--
T