Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: most efficient way to implement "A without B"

by bobf (Monsignor)
on Apr 09, 2005 at 19:45 UTC ( #446291=note: print w/replies, xml ) Need Help??


in reply to most efficient way to implement "A without B"

It might be worthwhile to take a look at the List:: modules on CPAN, specifically List::Util and List::Compare. List::Util provides functions like min, max, and sum. List::Compare provides intersection, union, and (of relevance to the posted question) ways to determine which elements appear in one list but not the other.

Zaxo provided a very nice (and probably more efficient) solution, but the List:: modules will come in handy if you have to do more complicated functions.

HTH

  • Comment on Re: most efficient way to implement "A without B"

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2020-06-05 00:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (35 votes). Check out past polls.

    Notices?