in reply to Parsing with Regular Expressions

Random tip. Avoid prototypes like ($). See Re: Redirecting STDOUT from internal function with 5.6.1 restrictions and various discussions that you can find with Super Search for why.