in reply to Re: Best approach to creating a regex from a filehandle
in thread Best approach to creating a regex from a filehandle

Unless you're sure that the input file will only contain safe characters, you should call quotemeta on $_ inside the map.
Also, what's the benefit of chaining two map's like that, instead of combining them into one?

Edit: Oops, I only just now noticed that choroba already mentioned quotemeta in his answer. Sorry for the redundancy.

Replies are listed 'Best First'.
Re^3: Best approach to creating a regex from a filehandle
by toolic (Bishop) on May 18, 2014 at 22:15 UTC
    You're right... it can be simplified using a single map
    my $blacklist_regex = join "|" => map { chomp; "(?:$_)"} <BLIST>;