in reply to Slow regexp

You might look at HTML::Parser instead of rolling your own.

Failing that, you might try combining many of these into one search, so you're not looping through the data so much. Maybe something like:

while ($html =~ /<(\w+).*?>\b$WHATWANT{'term'}?s?\b.*?</\1>/gis) { my $tag = $1; $tag =~ tr/A-Z/a-z/; if ($tag eq 'title') { } elsif ($tag eq 'h1') { #.... }
Your two patterns for single quote vs double quote could be reduced to one, like
while ($html =~ /href=(['"]).*?$WHATWANT{'term'}'?s?.*?\1/gis) { $term +shref++; } ## End while

Caution: Contents may have been coded under pressure.