Hello Ken

I've read printf FORMAT LIST and edited your program to learn how it behaves; however, I do not understand it completely, can you explain some things I am still doubtful?

So, I edited your $fmt statement and tried to left-adjust and play with the spaces in between columns; however, I cannot understand the spaces between the 3rd and 4th columns.

 my $fmt = "%-13s % 24f %-24f %-4s\n %38.6f %14f %-4s\n";

the output of some of the 2nd columns seems to be left-justified except when the number is negative. How can that negative be moved in one more space so everything is left-justified?

And, the spacing between the 3rd and 4th columns are not clear to me yet? I know that Between the % and the format letter, some attributes control the interpretation, Can you explain how these spaces are moved in the 3rd and 4th fields?

MM_STD_gate 152.401574 -22.047244 mils 3871.000000 -560.000000 microns RFN_a 337.244094 0.787402 mils 8566.000000 20.000000 microns RFN_b 366.181102 0.787402 mils 9301.000000 20.000000 microns RFN_c 376.929133 0.787402 mils 9574.000000 20.000000 microns MM_STD2_gate -259.488188 -22.047244 mils -6591.000000 -560.000000 microns RBASE_right_2 -366.181102 -33.464566 mils -9301.000000 -850.000000 microns

I'll like to see all columns left-justified (the negative number is also left-justified with the number below or above) and little bigger spaces in between. Note, that there can only be 6 decimal numbers in columns and upto 13-character string name is allowed.

MM_STD_gate 152.401574 -22.047244 mils 3871.000000 -560.000000 microns RFN_a 337.244094 0.787402 mils 8566.000000 20.000000 microns RFN_b 366.181102 0.787402 mils 9301.000000 20.000000 microns RFN_c 376.929133 0.787402 mils 9574.000000 20.000000 microns MM_STD2_gate -259.488188 -22.047244 mils -6591.000000 -560.000000 microns RBASE_right_2 -366.181102 -33.464566 mils -9301.000000 -850.000000 microns

thanks for the explanations!


In reply to Re^2: Help with Creating a Table from array ref I parsed in by perlynewby
in thread Help with Creating a Table from array ref I parsed in by perlynewby

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.