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.
Does this make hash into hashes or I am not in the right path.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;
In reply to Parsing a file and storing the data by Whiteinch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |