printf problem
- From: jpfun@xxxxxxxxxxxxxx (Julie A. Bolduc)
- Date: Mon, 29 Oct 2007 20:22:47 -0400
I am trying to format some numbers so single digit numbers are converted to 2 digit numbers and here is the code I am working with right now. For some reason, the very last number, $b5, ends up as a 3 digit number instead of a 2 digit number even if I start it with a single digit number. If I add chop($bcol); to the code, it cuts the last digit off but what if I do not need to have that happen? I am not exactly new to perl but this has me stumped.
print "Content-type: text/html\n\n";
$b1=11;
$b2=2;
$b3=5;
$b4=1;
$b5=12;
$bcol=printf("%02d %02d %02d %02d %02d", $b1, $b2, $b3, $b4, $b5);
#chop($bcol);
print qq($bcol);
Can anyone help?
Julie A. Bolduc
Owner, JPF Crochet Club
http://www.jpfun.com
.
- Follow-Ups:
- Re: printf problem
- From: Paul Lalli
- Re: printf problem
- Prev by Date: Re: help on ip addr
- Next by Date: Re: dereferencing
- Previous by thread: dereferencing
- Next by thread: Re: printf problem
- Index(es):
Relevant Pages
|