Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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]
[stevieb]: did my pull request challenge today, Locale::gettext. Weird layout for a dist, and I have no idea how to use it, but it's always nice when you can force someone else's work be use strict; and use warnings; compliant :)
[stevieb]: ahem... s/no idea how to use it/didn't read enough as to what it's used for/
[stevieb]: interestingly enough, someone else got my Devel::Examine:: Subs distribution for their PRC, and I applaud the change. This dist is extremely complicated and mostly obfu, but the person doing it understood PPI enough to change...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2017-01-24 01:14 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (199 votes). Check out past polls.