Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: The error says the value is uninitialized, but it works anyway

by haukex (Chancellor)
on Aug 19, 2019 at 07:33 UTC ( #11104685=note: print w/replies, xml ) Need Help??


in reply to Re: The error says the value is uninitialized, but it works anyway
in thread The error says the value is uninitialized, but it works anyway

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 ... }.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11104685]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (11)
As of 2019-10-22 14:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?