Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Subtract arrays (RE: I have contributed a module to CPAN)

by tye (Sage)
on Sep 21, 2000 at 20:00 UTC ( #33507=note: print w/replies, xml ) Need Help??

in reply to RE: I have contributed a module to CPAN
in thread I have contributed a module to CPAN

In the works unless I know of something better: a module to return the subtraction of the contents of arrays.

You mean something like:

# "Subtract" (remove) elements of @minus from @list: my %dup; @dup{@minus}= (); @list= grep { exists $dup{$_} } @list;

Update: Thanks to PrincePawn for noting that I left out "not" above.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
RE: Subtract arrays (RE: I have contributed a module to CPAN)
by Fastolfe (Vicar) on Sep 21, 2000 at 20:07 UTC
    Set::Scalar has functionality like this.. Set intersections, unions, subsets, etc.
RE: Subtract arrays (RE: I have contributed a module to CPAN)
by princepawn (Parson) on Sep 21, 2000 at 20:18 UTC
    This looks like the intersection
    grep { not exists $dup{$_} } @list
    should be the difference.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://33507]
[stevieb]: shmem thanks for the 'insight' :P
[shmem]: good thing that Sun already took "OpenWindows", otherwise I'd not stop to shudder imagining an "OpenWindows" from MS
[shmem]: more garbage in, more garbage out that would be
[stevieb]: I found that win10 broke a C# library I was using for one project while enhancing tests for a Perl dist, which breaks other Perl dists, and I'm about to throw my hands up on berrybrew. win2k12 broke one thing, win10 breaks something...
[stevieb]: ...unrelated which requires replacing a lot of code and a whole lib. I'm about to go nix only ffs
[shmem]: stevieb: what you're doing sounds afwully complex. Too much for me this evening to provide brighter insight ;-)
[stevieb]: I don't even own a Windows computer. Both my girl and I have a laptop each with Linux. I'm supporting Windows in some of my projects and I can't even guage whether it's worth it or not.
[stevieb]: shmem It's something I desired to have years ago, which is why I took over berrybrew. Cross-platform build/test automation locally, or over the network Test::BrewBuild
[shmem]: sounds good.
[shmem]: but I'm crumbling smaller stones. remember...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-03-28 22:04 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (342 votes). Check out past polls.