in reply to Re: Check array for several matches
in thread Check array for several matches
In addition to haukex's comments here, I would say that the
@required = keys %{{ map { $_ => 1 } @required }};
and
@notthere = keys %{{ map { $_ => 1 } @notthere }};
statements are unnecessary. All they do is rearrange the order of elements in the respective arrays in a more-or-less random way, and this rearrangement has no useful effect.
c:\@Work\Perl>perl -wMstrict -le "my @allwords = qw(this is a list of words that is required for tests) +; my @required = qw(this is a list of words that is required); ;; my %hash = map { $_ => 1 } @allwords; ;; print 'do stuff' if @required == grep { defined $_ } @hash{@required}; ;; my @notthere = qw(this list is not there in allwords); ;; print 'do not do stuff' unless @notthere == grep { defined $_ } @hash{@notthere}; " do stuff do not do stuff
Give a man a fish: <%-{-{-{-<
|
|---|