printf problem



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

.



Relevant Pages

  • Re: What is the Best Way to Fill a Pre Printed Form With Various Data
    ... The number of pages (single digit) ... The container number. ... | with a new batch of page and number of pages for each container. ...
    (microsoft.public.office.misc)
  • Re: truncating text
    ... Fakename wrote: ... only want a single digit number to display on the button. ... Problem is when I make the button real small, the text disappears and I get three dots instead. ... a large digit image is scaled to fill the space available: ...
    (comp.lang.java.help)
  • Re: Regexp match question !
    ... > I'm trying to match only a one single digit and wrote this code: ... Your regular expression has a word boundary anchor after a single ...
    (perl.beginners)
  • Re: Recent Coin Flip Post Reminds me of...
    ... various computational problems, e.g., extracting discrete logs. ... DA provides a Single Digit Number ... DB says Multiple And The Two Original 6 Digit Numbers are Multiplied ...
    (sci.crypt)
  • Re: Left Justification Question ?
    ... I'm on an XL97 machine today and there's nothing wrong with it as long as ... Anyway, after you align to the left, custom format using: ... I have a column of numbers; single and two digit. ... I have a few single digit numbers in the column, though, that I would like ...
    (microsoft.public.excel)