Formating with printf in using two functions

Posted by user317203 on Stack Overflow See other posts from Stack Overflow or by user317203
Published on 2010-04-15T06:46:27Z Indexed on 2010/04/15 6:53 UTC
Read the original article Hit count: 235

Filed under:
|

I am trying to output a document that looks like this.

http://pastebin.com/dpBAY8Sb

my issue is that I cannot find how to format the output I have to have a floating poing and format the distance between columns. My current code looks something like this.

if (defined $longitude){ printf FILE ("%-8s %.6f","",$longitude); }else{ $longitude = ""; printf FILE ("%-20s ",$longitude); }

but the extra "" throws off the whole column and it looks like this.

pastebin.com/kcwHyNwb

© Stack Overflow or respective owner

Related posts about perl

Related posts about printf