in reply to Re: Left padding a number with zeros: PerlFaq method didn't work for me.
in thread Left padding a number with zeros: PerlFaq method didn't work for me.
Ok...ever have one of those days when you start to lose track of what you did? Well, this thread may prove that! It's been a LONG day, and last nite was also, trying to get a new utility configured to work on my sys. Thus, in looking for the code that didn't work (backup file), I realized that there was a tilde (in addition to equals, so =~) in there that I must have removed VERY late last nite! So that may well explain it...
But I do believe/think I tried it the first line way also with same failure. FAQ says "you can use an integer in place of $pad_len if you know the pad length in advance."
I had the problem about 2am last nite and remembered just now that I was going to ask about it...so I posted while doing some other tasks...oops, ok?
But I do believe/think I tried it the first line way also with same failure. FAQ says "you can use an integer in place of $pad_len if you know the pad length in advance."
$Wmmyy = sprintf("%0${4}d", $FORM{'SRmmyy'});<br> $Wmmyy = sprintf("%0*d", 4, $FORM{'SRmmyy'});
I had the problem about 2am last nite and remembered just now that I was going to ask about it...so I posted while doing some other tasks...oops, ok?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Left padding a number with zeros: PerlFaq method didn't work for me.
by helphand (Pilgrim) on Jan 17, 2006 at 04:31 UTC | |
Re^3: Left padding a number with zeros: PerlFaq method didn't work for me.
by ChemBoy (Priest) on Jan 17, 2006 at 04:45 UTC | |
Re^3: Left padding a number with zeros: PerlFaq method didn't work for me.
by McDarren (Abbot) on Jan 17, 2006 at 04:46 UTC | |
by JCHallgren (Sexton) on Jan 17, 2006 at 06:49 UTC |
In Section
Seekers of Perl Wisdom