Sorry, that package reads from a specified filename and the subroutine is as following:

sub read_file { my $self = shift; my $filename = shift; my $i = 0; my $header_parse = 0; my $header_name = 0; open FILE, "<$filename" or die "cannot open $filename for input\n"; while (my $line = readline (*FILE)) { # Strip newlines and leading / trailing whitespace for ($line) { chomp; s/^\s+//; s/\s+$//; } # Skip blank lines and comments next if ($line !~ m/\w/ || $line =~ m/^#/); if ($line =~ m/^\[\s*([\w|\s]+)\s*\]/) { $header_name = $1; $header_parse = 1; } elsif ($header_parse) { $self->{HEADERS}{$header_name} = $line; $header_parse = 0; } else { my @data = split $self->{REGEX}, $line; $self->{DATA}[$i++] = \@data; } } close FILE; }

The first matrix/table in a .csv file I need to read/loop from is as following:

POSITION R CH TW TH

1 2 2.0 60 100

2 4 2.5 61 100

3 6 2.8 62 88

.. .. .. .. ..

N 40 0.9 74 18

while the structure of one of the J tables linked to the first table through the TH array is as following:

Header 100 (or a value from 88 .. to 18, referring to TH in the first table)

A B

-180 0.1

.. ..

M 0.9

I don't know how to parse the header (in the first table) in one of the J tables with the corresponding header.


In reply to Re^2: parsing with Workflow::csv_File by devoted_to_Perl
in thread parsing with Workflow::csv_File by devoted_to_Perl

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.