![]() |
|
Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: replace middle spaces with commasby Anonyrnous Monk (Hermit) |
on Feb 02, 2011 at 04:56 UTC ( [id://885663]=note: print w/replies, xml ) | Need Help?? |
I want commas in middle spaces not at the end, but here I got commas at the end also... AFAICT, your problem arises from using \s in the substitution s/\s/,/g, instead of a plain space character, i.e. s/ /,/g. \s stands for "whitespace", which includes newline (\n), so the newlines are turned into commas, too.
In Section
Seekers of Perl Wisdom
|
|