in reply to Best approach to creating a regex from a filehandle

There is no need for the array:
my $blacklist_regex = join "|" => map {"(?:$_)"} map { chomp; $_ } <BL +IST>;

Replies are listed 'Best First'.
Re^2: Best approach to creating a regex from a filehandle
by smls (Friar) on May 18, 2014 at 20:26 UTC

    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.

      You're right... it can be simplified using a single map
      my $blacklist_regex = join "|" => map { chomp; "(?:$_)"} <BLIST>;