$htmlcontent =~ s/ //g; #remove tabs $htmlcontent =~ s/<[^>]*>/,/g; #convert html tags into commas $htmlcontent =~ s/,,/,/g; #Convert double commas to single $htmlcontent =~ s/,\n,/\n/g; #remove leading and trailing commas around newlines $htmlcontent =~ s/,Function Name,Calls,Total Time,Avg\. Time/Function Name,Calls,Total Time,Avg\. Time/g; #Clean up column headers $htmlcontent =~ s/,Cache Status,\n//; #nuke the cache status line $htmlcontent =~ s/Profile\n//; #nuke the profile line $htmlcontent =~ s/\n+/\n/g; #delete blank lines $htmlcontent =~ s/,\n//g; #nuke lines with a comma followed by a new line $htmlcontent =~ s/^(?:.*\n){0,1}//; #remove first line $htmlcontent =~ s/,$//g; #nuke that pesky last line