Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Becomes this:this is a string
:::this is a string
Could someone take pity on me and point out the extremely obvious error that I'm overlooking.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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: substitute leading whitespace
by japhy (Canon) on Jun 10, 2005 at 06:28 UTC | |
by Anonymous Monk on Jun 10, 2005 at 06:30 UTC | |
|
Re: substitute leading whitespace
by ikegami (Patriarch) on Jun 10, 2005 at 06:28 UTC | |
by tlm (Prior) on Jun 10, 2005 at 10:46 UTC | |
by ikegami (Patriarch) on Jun 10, 2005 at 14:59 UTC | |
by tlm (Prior) on Jun 11, 2005 at 18:55 UTC | |
|
Re: substitute leading whitespace
by kaif (Friar) on Jun 10, 2005 at 06:18 UTC | |
|
Re: substitute leading whitespace
by Elijah (Hermit) on Jun 10, 2005 at 06:33 UTC | |
by Anonymous Monk on Jun 11, 2005 at 05:46 UTC | |
by Elijah (Hermit) on Jun 12, 2005 at 22:42 UTC |