while ($html =~ /href=(['"]).*?$WHATWANT{'term'}'?s?.*?\1/gis) { $termshref++; } ## End while