use strict; use warnings; my $string = "I love my nation"; #leaving one space and substitute 2 or more spaces with comma globally $string =~ s/\s{2,}/,/g; print "$string\n";
Output:
I love,my nationIn reply to Re: Replace only tab space with commas
by Nikhil Jain
in thread Replace only tab space with commas
by sufi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |