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: <%-{-{-{-<
In reply to Re^2: Check array for several matches
by AnomalousMonk
in thread Check array for several matches
by Bman70
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |