Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: get the Difference between two arrays

by LanX (Saint)
on Apr 02, 2018 at 19:05 UTC ( [id://1212197]=note: print w/replies, xml ) Need Help??


in reply to Re: get the Difference between two arrays
in thread get the Difference between two arrays

> Use hash slices to create hashes and delete via hash slice.

like this Using hashes for set operations... ? :)

update

use strict; use warnings; use Data::Dump qw/pp dd/; my @Llist = qw(abel abel baker camera delta edward fargo golfer); my @Rlist = qw(baker camera delta delta edward fargo golfer hilton); my %tmp; @tmp{@Rlist} = @Rlist; delete @tmp{@Llist}; pp values %tmp;
"hilton"

please note this is restricted to keys with different string representation.

Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Wikisyntax for the Monastery

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1212197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-23 23:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found