Keep It Simple, Stupid | |
PerlMonks |
Re^2: The error says the value is uninitialized, but it works anywayby haukex (Archbishop) |
on Aug 19, 2019 at 11:33 UTC ( [id://11104685]=note: print w/replies, xml ) | Need Help?? |
my $x = join '|', @drop; /$x/ ? () : $_ While this may work for the example in the root node, it's of course pretty inefficient to build the regex on every iteration of the loop. And, the regex will match more than fixed strings, because it doesn't escape metacharacters and isn't anchored - see Building Regex Alternations Dynamically (as has been mentioned several times already). Plus, map { ... ? () : $_ } is perhaps better written as grep { not ... }.
In Section
Seekers of Perl Wisdom
|
|