Help for this page

Select Code to Download


  1. or download this
    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";