RE: Replace Leading Spaces

2006-04-07 Thread Ken Kriesel
Why not the more concise $string =~ s/^(\s+)/'0'x(length $1)/e; as in my $string = ' 259.00 '; print "<$string>\n"; #$string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; $string =~ s/^(\s+)/'0'x(length $1)/e; print "<$string>\n"; which outputs: < 259.00 > <0259.00 > showing same spacin

RE: Replace Leading Spaces

2006-04-07 Thread Ken Kriesel
Oops, I see I misattributed 2 lines. my $string = ' 259.00 '; print "<$string>\n"; #$string =~ s/^(\s+)(?=\d)/'0'x(length $1)/e; #Mike Arms posted $string =~ s/^(\s+)/'0'x(length $1)/e; #Paul Sobey; quicker than above line print "<$string>\n"; which outputs: < 259.00 > <0259.00 >