in reply to substitute leading whitespace
Something like this will do what you are looking for. Of course there are probably other ways of doing this too but this is the first that comes to my mind.my $string = ' this is a string'; my $rep; $string =~ s/(^\s+)/$rep.=':' for(1..length($1)); "$rep"/eg; print $string;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: substitute leading whitespace
by Anonymous Monk on Jun 11, 2005 at 05:46 UTC | |
by Elijah (Hermit) on Jun 12, 2005 at 22:42 UTC |