That unilaterally removes all leading spaces. I want to maintain any relative indentation. For example:
hello
one
two
should be transformed to:
hello
one
two
i.e. remove two spaces from each line in this case because the minimum number of leading spaces in any line is two. Sorry if I was unclear.
| [reply] [d/l] [select] |
$s =~ s[^ ][]mg while not $s =~ m[^[^ ]]mg;
Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller
| [reply] [d/l] |
Very concsie, but gets very slow for big strings with lots of space, as it will loop through the entire string once for each leading space it removes.
Bob Niederman, http://bob-n.com
| [reply] |