D
Dave
I've written a perl program to manipulate data formats so that I can import
data from an estimating software program to an accounting program. Works
just fine, with the following caveat: The record identifier field is
numeric in the estimating program but it can be (and is interpreted as) a
string in the accounting software. Hence, when I bring up project data in
the accounting software, my items look like so:
10
100
110
....
190
20
210
220
These fields MUST be left-justified for importation into the account s/w, so
I am using "@<<<<<<" in my format block. I'd like to be able to pad all
items to four decimal places with zeroes so that I'd end up with:
010
020
030
....
090
100
etc.
Can anyone tell me of a simple way to do this in perl? I've read and read
and read the manpages on printf() and sprintf() but can't seem to figure out
the syntax. Basically I'm printing out 19 fields, the first three are
left-justified (strings) with varying lengths and the rest for the most part
are seven-dot-three numerics. It would have been easier I'm sure to use
printf with some modifiers rather than type in all those "###'s" and
"<<<'s". Can anyone point me to an online resource to figure out printf
with some real world examples?
Thanks
Dave
data from an estimating software program to an accounting program. Works
just fine, with the following caveat: The record identifier field is
numeric in the estimating program but it can be (and is interpreted as) a
string in the accounting software. Hence, when I bring up project data in
the accounting software, my items look like so:
10
100
110
....
190
20
210
220
These fields MUST be left-justified for importation into the account s/w, so
I am using "@<<<<<<" in my format block. I'd like to be able to pad all
items to four decimal places with zeroes so that I'd end up with:
010
020
030
....
090
100
etc.
Can anyone tell me of a simple way to do this in perl? I've read and read
and read the manpages on printf() and sprintf() but can't seem to figure out
the syntax. Basically I'm printing out 19 fields, the first three are
left-justified (strings) with varying lengths and the rest for the most part
are seven-dot-three numerics. It would have been easier I'm sure to use
printf with some modifiers rather than type in all those "###'s" and
"<<<'s". Can anyone point me to an online resource to figure out printf
with some real world examples?
Thanks
Dave