in reply to Comparing Regular Expressions
You might also consider
$text =~ s/\s+,\s*|,\s+/,/g; [download]
The regular expression engine is evolving. You might get quite different relative performance, depending on the version of perl you are using.