in reply to Re: Re: Zero Padding
in thread Zero Padding

try this
$foo = 0000
$foo .= $number

Replies are listed 'Best First'.
(yakko) Re: Zero Padding
by yakko (Friar) on Feb 03, 2001 at 10:27 UTC
    In the spirit of TIMTOWTDI, I offer my version from my FPBASIC days:
    my $num=42; my $padto="000000"; # padding to 6digs $num=$padto.$num; print substr($num,-6), "\n";
    Not the shortest, but a valid solution. Of course, I'd use printf() as mentioned zillions of times.

    --
    Me spell chucker work grate. Need grandma chicken.