in reply to sprintf zero-fill issue
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; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: sprintf zero-fill issue
by apl (Monsignor) on Jun 28, 2007 at 14:00 UTC |