Hi I am really new in Perl and would like to gain more knowledge in here. I have gone through the basic tutorials but I am stuck in parsing a file and storing the data. If there is any help or guidance would be really helpful. My file data is a table that would be something like this:

(DATA 1) (DATA 2)

Column 1 Column 2 Column 3 Column 4

(DATA 3) (DATA 4) (DATA 5) (DATA 6)

There are many table as shown above and each has many rows in it. I would like to save all the data into a hash that would be something like

{DATA 2} = {DATA 1} = {DATA 3} {DATA 4} {DATA 5} {DATA 6}

What I have done so far is as shown below and is far from the right path as I thought.

my $line = $_; if (/^\s*(-\d+\.*\d*),(\d+\.*\d*),(\d+\.*\d*),(\S+),(\S+),(\S+),(\ +S+)$/) { my $data1 = $1; my $data2 = $2; my $data3 = $3; my $data4 = $4; my $data5 = $5; my $data6 = $6; $hash{data2}{data1}{data3} = $data3; $hash{data2}{data1}{data4} = $data4; $hash{data2}{data1}{data5} = $data5; $hash{data2}{data1}{data6} = $data6;
Does this make hash into hashes or I am not in the right path.

In reply to Parsing a file and storing the data by Whiteinch

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.