I'm new to Perl, but I needed it to get some text out of some awful HTML file. In the code so far, I have got to the point I have extracted all the values I need (I verified it works with data dumper):
For every data record i.e. row of a 2D table they are called:
$org, $gene_name, $number, $motif_num, $pos, $strand, $seq
I have many data entries and each one would be a row, with the above values as the columns.
To do other stuff with them later, I want to make a 2D array structure, so I can loop through each entry (row) and pick out values I need and so on.
I thought the best way of doing this would to use the loop and for each data entry, after extracting the values with regexp matching, combine the values/columns into an array for the individual data record:
my @seidl_array_row = ($org, $gene_name, $number, $motif_num, $pos, $strand, $seq);
Then push this array onto the finished 2D array of arrays:
push @seidl_array, [ @seidl_array_row ];
(@seidl_array was defined with my before the loop.)
So in effect I get a 2D data table, where each element of the array @seidl_array is an array containing the values $org, $gene_name, $number, $motif_num, $pos, $strand, and $seq.
I'm new to Perl, so I don't know if this was the right way to do it programmatically, since I'm having issues when it comes to doing stuff later with this data. I wondered if the issue was with how I constructed the array of arrays in the first place. Examples in my book do it statically with simple data sets, and this is a much larger genomic data gtf file, so doing it statically is not really feasible.