in reply to Re^10: partial matching of lines in perl
in thread partial matching of lines in perl
Perhaps your algorithm is wrong or perhaps your data isn't what you think it is. Here is an SSCCE:
#!/usr/bin/env perl use strict; use warnings; my @a2 = qw/foo bar baz/; my $match = join '|', @a2; my @a1 = qw/bar quux/; print grep {$_ !~ $match} @a1;
This prints one blank line (for "bar") and one line with "quux" in it. Do you understand why?
Amended thanks to AnomalousMonk for pointing out the error.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^12: partial matching of lines in perl
by AnomalousMonk (Archbishop) on Jun 15, 2020 at 18:46 UTC |