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

Re: Subtracting one array from another (both have duplicate entries)

by karlgoethebier (Abbot)
on Dec 04, 2013 at 15:12 UTC ( [id://1065604]=note: print w/replies, xml ) Need Help??


in reply to Subtracting one array from another (both have duplicate entries)

use Data::Dumper; use Data::Difference qw(data_diff); my @letters = qw( a a a b b b c c c ); my @word = qw( a a a b b); my @diff = data_diff( \@letters, \@word ); print Dumper( \@diff ); for (@diff) { print $_->{a} } __END__ $VAR1 = [ { 'a' => 'b', 'path' => [ 5 ] }, { 'a' => 'c', 'path' => [ 6 ] }, { 'a' => 'c', 'path' => [ 7 ] }, { 'a' => 'c', 'path' => [ 8 ] } ]; bccc

Update: "If you don't know the algorithm quickly, it's better to check out a module." (Karl Goethebier, PerlMustard)

Regards, Karl

«The Crux of the Biscuit is the Apostrophe»

  • Comment on Re: Subtracting one array from another (both have duplicate entries)
  • Download Code

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2024-04-24 20:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found