in reply to Zero Padding
$num = 13; $len = 6; $padnum = 0 x ($len - length($num)) . $num; [download]
I posted a similar solution here, but with one difference - the 0 was quoted.
At first glance, you might think "So what?", but in benchmarks it actually was 25% faster than the unquoted version.
I assume this is because perl has to do less work to figure out the context of 0 and transform it into a string.