Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: get the Difference between two arrays

by LanX (Cardinal)
on Apr 02, 2018 at 19:05 UTC ( #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
Node Status?
node history
Node Type: note [id://1212197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-06-23 00:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What does the "s" stand for in "perls"? (Whence perls)












    Results (110 votes). Check out past polls.

    Notices?