|There's more than one way to do things|
Write padded output without newlineby firmament (Novice)
|on Mar 06, 2013 at 12:20 UTC||Need Help??|
firmament has asked for the
wisdom of the Perl Monks concerning the following question:
Brain cramp after a large number of tries.
I want to read a cr/lf terminated file line by line and write each line as 200 bytes left justified and padded with blanks to another file, that is no newlines in the outfile. You can see below what I have at the moment.
The output is not very near what I want:
Line #1: left justified, trailing blanks removed, i.e. _not_ 200 bytes wide
subsequent lines: right justified, padded with blanks, 200 bytes wide.
As mentioned, I donít want a newline at all. And itís not very nice that the first line is printed differently than all the others.