my $search = join "|", map { qr-\b\Q$_\E\b- } keys %repl; #### use Regexp::List; my $search = Regexp::List->new->list2re(keys %repl);