vitoco has asked for the wisdom of the Perl Monks concerning the following question:
I want to know which of the following regexps to remove spaces around commas is more efficient:
$text =~ s/\s+,\s+|\s+,|,\s+/,/g; $text =~ s/\s*,\s*/,/g;
Common sense (not Common::Sense) tells me that the first one should be faster on large texts with more commas than spaces, because less replaces would be done, but I don't know how to measure that.
Hints?
Back to
Seekers of Perl Wisdom