this is a string #### :::this is a string #### my $string = ' this is a string'; # below replaces first whitespace char, leaves the rest $string =~ s/^\s/:/g; # below replaces first whitespace char, remotes the rest $string =~ s/^\s+/:/g;
## :::this is a string ##
## my $string = ' this is a string'; # below replaces first whitespace char, leaves the rest $string =~ s/^\s/:/g; # below replaces first whitespace char, remotes the rest $string =~ s/^\s+/:/g;