in reply to sprintf vs. substr (for zero-padded values)
another way to do it:
sub three { my $number = "213"; return '0' x (9 - length($number)) . $number; } [download]
Update: you might want to test/benchmark this before thinking it is "good"