Perl cant add up with sprintf ?

2004-11-25 Thread David Clarke
I have an 11 digit number. I want to add another number to it and format to 11 digits as well. my $amount1 = 14313562897; my $amount2 = 0013625; $amount = sprintf("%011d", $amount1 + $amount2); print $amount."\n"; The answer perl gives me is -01 How can this be ? As well, if th

sprintf query

2004-11-24 Thread David Clarke
Does anyone know how to format a string so that the spaces are padded on the right, not the left. Im using $dates = sprintf("%64s", $dates); this right justifies the data and pads the left with spaces. I need the other way around - left justified and padded with spaces on the right. ***

RE: New Line / Chomp Query

2004-07-25 Thread David Clarke
the latest file which ends in the 0d0a. Maybe my code is not correct or unstable ? -Original Message- From: Bob Showalter [mailto:[EMAIL PROTECTED] Sent: Friday, 23 July 2004 22:17 To: David Clarke; [EMAIL PROTECTED] Subject: RE: New Line / Chomp Query David Clarke wrote: > Hi, d

New Line / Chomp Query

2004-07-22 Thread David Clarke
Hi, does anyone know what the new line character value is in Hex for a text file ? Is it "0d 0a" ? I'm trying to read in a line of text, chomp it, attach 3 digits at the end of this line, then write this line to output file. But when I write it out, the original input line is written out, the

Breaking up a large text stirng

2004-07-14 Thread David Clarke
Hi, I have a string of text that is thousands of characters in length. And I want to break it up into smaller records of say 500 or 600 characters. Is there a Perl command to help to do this or am I stuck with looping through the large input record and counting field positions myself. Thanks a