in reply to Removal of values in array from array list
jemswira,
Is there anything faster than checking like this?
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.
If your pseudo notation implied something else. Use real code and repost.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}; } }
Cheers - L~R
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Removal of values in array from array list
by Anonymous Monk on Aug 31, 2012 at 00:26 UTC | |
Re^2: Removal of values in array from array list
by jemswira (Novice) on Aug 31, 2012 at 12:37 UTC |
In Section
Seekers of Perl Wisdom