in reply to Re: Re: Re: Arrays
in thread Comparing Two Arrays

@array3 = keys %{{ map {$_ =>1} @array1, @array2 }};

I see no need for a map here:

my @union = keys %{{(@array1,@array2)x2}};

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Arrays
by runrig (Abbot) on Dec 08, 2001 at 14:52 UTC
    AM said:
    I see no need for a map here:
    my @union = keys %{{(@array1,@array2)x2}};
    That doesn't work when (@array1+@array2) is even (unless you don't mind losing some of your data :)
    my @array1=qw(a b); my @array2=qw(c d); my @union = keys %{{(@array1,@array2)x2}}; print "$_\n" for @union; #prints: a c