Help for this page
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";