which may not be the most efficient, but I never have to look up sprintf, and neither will anyone who reads the script. This is a consideration for me, since almost nobody else at my shop knows perl, and a lot them don't know sprintf from Unix or C++ either.my $delta = $desired_length - length $number; while ($delta ne 0) { $number = '0' . $number; --$delta; }
In reply to Re: sprintf zero-fill issue
by girarde
in thread sprintf zero-fill issue
by mlong
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |