printf to format columns
Posted on 2004-09-07
I am new to Perl, so please forgive my limited knowledge...
I am reading in a CSV file and outputting the contents to several proprietary data formats that we use in-house. In order to do this, I need to reformat some of my data to fit within a 5 character column width.
I need to format as in the following example (note - column width is 5 characters):
1 -> 1.000
1.25 -> 1.250
23.2 -> 23.20
According to my reading, I should probably use something like printf("%0-5s","1.25") in order to format 1.25 to 1.250 however this isn't working for me!?!?