You might also consider
$text =~ s/\s+,\s*|,\s+/,/g;
The regular expression engine is evolving. You might get quite different relative performance, depending on the version of perl you are using.
In reply to Re: Comparing Regular Expressions
by ig
in thread Comparing Regular Expressions
by vitoco
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |