dwatson06 has asked for the wisdom of the Perl Monks concerning the following question:
I am trying to write a set of numbers to a file so that another programmer may reference them. This number needs to be zero filled with 9 digits. I can use the following to print out on the command line...
my $getNumber = 213;
printf "%09d$getNumber";
And it prints fine but when I write to file it writes%09d213.
Is there a simple sub included to pad numbers (or zero fill) to a given length?
Thank you,
Daniel
my $getNumber = 213;
printf "%09d$getNumber";
And it prints fine but when I write to file it writes%09d213.
Is there a simple sub included to pad numbers (or zero fill) to a given length?
Thank you,
Daniel
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Problems with zero filling a number.
by broquaint (Abbot) on Jul 15, 2002 at 18:52 UTC | |
Re: Problems with zero filling a number.
by thelenm (Vicar) on Jul 15, 2002 at 18:54 UTC | |
Re: Problems with zero filling a number.
by Abigail-II (Bishop) on Jul 16, 2002 at 12:08 UTC |
Back to
Seekers of Perl Wisdom