Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^2: Need to Create an Array of Differences

by scottj (Monk)
on Aug 03, 2004 at 02:13 UTC ( #379500=note: print w/replies, xml ) Need Help??


in reply to Re: Need to Create an Array of Differences
in thread Need to Create an Array of Differences

I ended up doing something like this:
# given @a, @b my %a; @a{@a} = (); delete @a{@b}; my @c = keys %a;
This code works just as well as my previous code with the exception that the new code is much faster. Thanks!

-Scott

Replies are listed 'Best First'.
Re^3: Need to Create an Array of Differences
by revdiablo (Prior) on Aug 03, 2004 at 04:02 UTC

    I assume the code does what you need, but there are a few caveats that should be mentioned. This code will change the order of the values, and it will eliminate any duplicates. This may or may not be a problem, depending on what it's being used for.

    Update: these caveats were noted, in Zaxo's original node, I just failed to notice. My apologies.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2022-05-17 12:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (65 votes). Check out past polls.

    Notices?