Moon, John wrote:
> Does any one know how to do this with just a substitution?
>
> perl -e '$a=q{Data.m1234.D1234567890};
> $a =~/\d+$/;
> $numbers = q{#} x length($&);
> $a=~ s/\d+$/$numbers/; print "$a\n";'
>
> What " Data.m1234.D########## " as a result.
$ perl -le'$_ = q{Data.m1234.D1234567890};
s/(\d+)$/ "#" x length $1 /e;
print;
'
Data.m1234.D##########
$ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(#*)$/#$1/; print'
Data.m1234.D##########
$ perl -le'$_ = q{Data.m1234.D1234567890}; 1 while s/\d(?=#*$)/#/; print'
Data.m1234.D##########
$ perl -le'$_ = q{Data.m1234.D1234567890}; s/\d(?=\d+$|$)/#/g; print'
Data.m1234.D##########
John
--
use Perl;
program
fulfillment
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>