Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Removal of values in array from array list

by Limbic~Region (Chancellor)
on Aug 30, 2012 at 19:17 UTC ( #990827=note: print w/ replies, xml ) Need Help??


in reply to Removal of values in array from array list

jemswira,
Is there anything faster than checking like this?

Yes. Or rather, maybe. It is hard to tell from your pseudo notation if you have a hash of arrays, a hash of hashes or just a hash with weird key/value pairs. Assuming you have a hash of hashes then yes.

my @tocheck = qw/Apple Corn Pie Fish/; my %checkfrom = ( Meat => { Fish => 1, Apple => 1, Pork => 1, Bacon => 1, }, Fruit => { Apple => 1, Pie => 1, Orange => 1, Beef => 1, }, ); for my $thing (@tocheck) { for my $category (keys %checkfrom) { delete $checkfrom{$category}{$thing}; } }
If your pseudo notation implied something else. Use real code and repost.

Cheers - L~R


Comment on Re: Removal of values in array from array list
Download Code
Re^2: Removal of values in array from array list
by Anonymous Monk on Aug 31, 2012 at 00:26 UTC
    Well it is a hash of arrays. It's just a small part of my program. The hash and array are both examples. It's actually protein numbers and stuff but the example still Holds.
Re^2: Removal of values in array from array list
by jemswira (Novice) on Aug 31, 2012 at 12:37 UTC

    Reposted

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2014-09-17 09:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (70 votes), past polls