in reply to Re: Pair of items
in thread Pair of items
Tweakism to get something like this:
grep is used to produce a list of matches, which is then negated, so that it returns a true value if there are no matches.
You seem to create a hash and then just iterate over its keys, instead of just using the straight list. Here I just make one hash and use the other list raw.sub is_ok { my ($x, $y) = @_; my %x; @x{@$x} = 1; return !grep { exists($x{$_}) } @$y; }
grep is used to produce a list of matches, which is then negated, so that it returns a true value if there are no matches.
|
---|
In Section
Seekers of Perl Wisdom