my $html = "
Bar
Some more text here
"; my @list = ('F(oo','Bar'); # you need to make the elements in @list regex # friendly by backslashing all the metachars # comment out this line to see this script choke # on the ( in F(oo s/([\$\^\*\(\)\+\{\[\\\|\.\?])/\\$1/g for @list; # eat up the bits in @list $html =~ m/$_/gc for @list; #use \G to match the rest ($rest) = $html =~ m/\G(.*)$/; print $rest; ####
# s/([\$\^\*\(\)\+\{\[\\\|\.\?])/\\$1/g for @list;
$_ = quotemeta $_ for @list;