in reply to Re: array comparison question
in thread array comparison question

it's a good solution, but I hate to see 'map' used instead of a 'for' unnecessarily, why make perl go to the trouble of building a return array if you're just going to ignore it? .
my @twice = do { my %tracker; foreach my $a_ref (\@a1, \@a2, \@a3) { foreach my $a_value (@$a_ref) { $tracker{$a_value}{$a_ref} = undef; } } grep {2 == keys %{$tracker{$_}}} keys %tracker; };
---
my name's not Keith, and I'm not reasonable.

Replies are listed 'Best First'.
Re^3: array comparison question
by Fletch (Bishop) on Aug 23, 2005 at 16:49 UTC

    So long as you're using 5.8.1 or newer map in a void context won't build a return list. See perldoc perl581delta in the section "Miscellaneous Enhancements".

    (Having said that, stylistically I'm with you. :)

    --
    We're looking for people in ATL