another way to do it:
sub three { my $number = "213"; return '0' x (9 - length($number)) . $number; }
Update: you might want to test/benchmark this before thinking it is "good"
In reply to Re: sprintf vs. substr (for zero-padded values)
by fglock
in thread sprintf vs. substr (for zero-padded values)
by Theseus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |