in reply to Improving performance

Don't guess at which things in your code might be slow, measure it, e.g. Devel::NYTProf

Also, using the same regex 250 times sounds like your code might be in need of some refactoring, like pulling any repeated code blocks into subroutines.