in reply to Replacement Regex
This isn't an answer to your question; this is just a reminder that you don't want to get into the bad habit of using $a and $b as sample variables (especially in sample code), since they have a special meaning to Perl.
Specifically, they're built-in package globals for use by the sort function. :-)
Impossible Robot