Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: Combining arrays with grep/unless?

by dorko (Parson)
on Feb 09, 2007 at 23:24 UTC ( #599300=note: print w/replies, xml ) Need Help??

in reply to Combining arrays with grep/unless?

List::Compare was built for working with two, three or more arrays at once.

use List::Compare; my @Llist = ('A','B','C','D','E'); my @Rlist = ( 'D','E','F','G','H','I','J'); my $lc = List::Compare->new(\@Llist, \@Rlist); # If I read your post correctly, # this is what you want. my @LorRonly = $lc->get_symmetric_difference; print join ", ", @LorRonly; # Also does... my @intersection = $lc->get_intersection; my @union = $lc->get_union; # And much, much more.

A, B, C, F, G, H, I, J



-- Yeah, I'm a Delt.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://599300]
[planetscape]: howdy stonecolddevin, erix
[Sinistral]: eric Aye. I thought I typed that wrong. All hail Randall! I listen to him on FLOSS Weekly
[Discipulus]: i think his vacuus, trombon like, absence of meaning, joined with a ostentatious style, after many years irritates the most
[erix]: easy to get wrong -- I guess that was sund's point, too :P
[Discipulus]: planetscape welcome back! (or is well comeback?)
[Discipulus]: fore every 2 good old monks that come back, we will accept 1 clinical
[planetscape]: Might be "well, come back!" Discipulus ;-)
[stonecolddevin]: that's a 2.0 k/d ratio, i'll take it

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2017-06-22 21:02 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (530 votes). Check out past polls.