I often have to parse such astronomical data. I think you have to get your hands dirty. I try to keep it simple as possible:
#!/usr/bin/perl use strict; use warnings; use Data::Dumper; # hash for data my $data = {}; # array of column names my @cols = (); for (<DATA>) { # normaliize the data next if /^\s/ or /^Annular/; if (/^Site/) { # grab column titles, minus the key (Site) @cols = map {$_} split /\s+/; shift @cols; } elsif (/\S+/) { # parse column data my @line = / ([A-Za-z ]+)\s+ # Site (\S+\s+\S+)\s+ # Longitude (\S+\s+\S+)\s+ # Latitude (\S+)\s+ # Elvn (\S+\s+\S+\s+\S+)\s+ # U.T. (\S+)\s+ # PA (\S+) # Alt /x; # clean the key my $site = do { $_ = shift @line; s/\s+$//; $_ }; next unless $site; # map titles to data my %line = do { @_{@cols} = @line; %_}; # add to hash $data->{$site} = \%line; } } # tada print Dumper $data; __DATA__ Annular-Total Eclipse of 2023 Apr 20 - multisite predictions 1st Contact Site Longitude Latitude Elvn U.T. PA Alt o ' o ' m h m s o o Auckland 174 45. -36 55. 0 4 33 59 313 13 Blenheim 173 55. -41 35. 30 4 40 34 326 11 Cape Palliser 175 25. -41 35. 0 4 42 28 327 9 Cape Reinga 172 45. -34 25. 50 4 30 11 307 17 Carterton 175 35. -41 5. 0 4 40 35 324 10 Dannevirke 176 5. -40 15. 200 4 39 9 321 10 East Cape 178 35. -37 45. 0 4 37 58 315 10 Featherston 175 25. -41 5. 40 4 40 36 325 10 Gisborne 178 5. -38 45. 0 4 38 29 317 10 Great Barrier Is 175 25. -36 15. 0 4 34 15 312 13
Output:
$VAR1 = {
          'Auckland' => {
                          'Longitude' => '174 45.',
                          'Alt' => '13',
                          'Elvn' => '0',
                          'Latitude' => '-36 55.',
                          'PA' => '313',
                          'U.T.' => '4 33 59'
                        },

In reply to Re: Module for parsing tables from plain text document by Anonymous Monk
in thread Module for parsing tables from plain text document by GrandFather

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.