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

Re: Compare arrays remove identical

by perlmonkey (Hermit)
on May 02, 2001 at 11:26 UTC ( [id://77256]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @kansas = qw( corn wheat hay cattle );
    my @oklahoma = qw( wheat dairy cattle );
    ...
      my %hash = map{ $_=>1} @{$_[1]}; 
      return grep { !defined $hash{$_} }  @{$_[0]};
    }
    
  2. or download this
    Benchmark: timing 100000 iterations of diff1, diff2...
         diff1:  2 wallclock secs ( 1.74 usr +  0.01 sys =  1.75 CPU)
         diff2:  3 wallclock secs ( 2.22 usr +  0.01 sys =  2.23 CPU)
    

Log In?
Username:
Password:

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

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

    No recent polls found