On 3/11/06, Chris Devers <[EMAIL PROTECTED]> wrote:
> On Sat, 11 Mar 2006, Harry Putnam wrote:
>
> > Its just the numeric part I need a jump start on.
>
> Have you looked at sprintf yet? `perldoc -f sprintf`
>
> That's probably the easiest way.
>
> Alternatively, you could do some kind of silly subroutine that padded
> two zeroes if $n > 10, one zero if $n > 100, etc. It wouldn't be that
> hard to do, but I think sprintf will be much easier.
>
>
> --
> Chris Devers
> DO NOT LEAVE IT IS NOT REAL
sprintf is definitly the correct answer, but just to prove TIMTOWTDI
#!/usr/bin/perl
use strict;
print zeropad(5,100), "\n";
sub zeropad {
my ($count, $n) = @_;
return substr '0' x $count . $n, -$count;
}
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>