my $short_num = 20188;
my $len = 10;
my $padded_num = sprintf ("%0${len}d", $short_num );
print $padded_num
prints:0000020188
Of course, there is no way to make an 11 digit number's length will not be greater than 10. ;)
In reply to Re: Adding Leading Zeros
by jaxon
in thread Adding Leading Zeros
by vanuatu10
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |