Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: Difference between two arrays - is there a better way?

by BrowserUk (Pope)
on Aug 09, 2011 at 09:06 UTC ( #919425=note: print w/replies, xml ) Need Help??


in reply to Difference between two arrays - is there a better way?

is there another clever way

Another way for sure. Whether it is "clever"?

@list1 = (1, 2, 3, 4, 5); @list2 = (2, 3, 4);; @diff{ @list2 }= ();; print grep !exists($diff{$_}), @list1;; 1 5

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2019-02-21 02:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I use postfix dereferencing ...









    Results (108 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!