. Advance the search starting pointer character counter given to index every time the index substr loop iterates. Much faster (I think 10x) than any regex for very simple matches. You could also make a copy of content and destroy the HTTP object. Remember you can open a new block with a new my scope where every you want in perl. You can also try
, I've used it personally but it was useless since it turned out the memory leaks I found were interpreter bugs, not perl language leaks. Also what is your regex? regexs can be optimized, to eliminate things like "backtracking"