Hello Monks, I need help understanding how to format some text. I opted for an array since I do not know how to add multiple values to key in a hash. Clearly, I do not understand how to manipulate the array of elements to create a table equally align.

desired output, name of probe on the left side then all (x,y) coords and units on the right:

MM_STD_gate -61.771653 -45.472441 mils + -1569.000000 -1155.000000 micro +ns RFN_a -91.102362 68.307087 mils + -2314.000000 1735.000000 micro +ns RFN_b -62.165354 68.307087 mils + -1579.000000 1735.000000 micron +s RFN_c -51.417322 68.307087 mils + -1306.000000 1735.000000 micro +ns
#!/usr/bin/perl #use strict; use warnings; use Data::Dumper; my @records; my @col; my ($probe, $x_coord, $y_coord, $mils, $micron); my $infile= 'coord.txt'; open (DATA,'<',$infile) or die "could not open the $infile: $!"; while (<DATA>) { chomp; my @col = split " ", $_; push @records, \@col; } #print Dumper(\@col, @records); for (\@col){ print join("\t",$col{$records[0]}, $col{$records[1]}, $col{$record +s[2]}, $col{$records[3]}); } #this for loop doesn't work

DATA can be presented in unalign format

__DATA__ MM_STD_gate -61.771653 -45.472441 mils -1569.000000 -1155.000000 microns RFN_a -91.102362 68.307087 mils + -2314.000000 1735.000000 microns RFN_b -62.165354 68.307087 mils + -1579.000000 1735.000000 microns RFN_c -51.417322 68.307087 mils + -1306.000000 1735.000000 + microns

In reply to 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.