![]() |
|
There's more than one way to do things | |
PerlMonks |
Re: Replace ".." with ","by afoken (Chancellor) |
on Apr 05, 2015 at 14:22 UTC ( #1122485=note: print w/replies, xml ) | Need Help?? |
"." needs to be escaped in regular expressions. Use s/\.{2}/,/g or s/[.]{2}/,/g. The former uses an escaped ".", the latter a character class containing only the "." Alexander Updated: First variant should be s/\.{2}/,/g, not s/\.{2}//,/g. Thanks to AnomalousMonk for spotting this bug.
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|