I share Laurent_R's confusion about the structure of your data. Here are some general thoughts.

Does this make hash into hashes ...
Why not see for yourself?
c:\@Work\Perl\monks>perl -wMstrict -le "use Data::Dumper; ;; $_ = '-1.23,4...5,6,foo,bar,baz,boff'; ;; my %hash; ;; 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; } ;; print Dumper \%hash; " $VAR1 = { 'data2' => { 'data1' => { 'data6' => 'baz', 'data4' => 'foo', 'data3' => '6', 'data5' => 'bar' } } };
(See the Data::Dumper module, which is core, for more info.) Is this the data structure you expected? Did you perhaps mean to write
    $hash{$data2}{$data1}{$data3} = $data3;
instead of
    $hash{data2}{data1}{data3} = $data3;
($data1 $data2 are unused otherwise)?

Are you aware that the regex
    /^\s*(-\d+\.*\d*),(\d+\.*\d*),(\d+\.*\d*),(\S+),(\S+),(\S+),(\S+)$/
has seven capture groups, but you only use six ($data6)? Are you aware that the regex expression  \.* matches zero or more  . (dot) characters (i.e., it matches '.....')?


Give a man a fish:  <%-{-{-{-<


In reply to Re: Parsing a file and storing the data by AnomalousMonk
in thread 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.