Welcome to the Monastery | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I want to be able manipulate the columns individually (thus attempting array) so I am not sure how hash can help in this case. In the case of using a hash of arrays (HoA), you can think of the arrays as named--although Perl has no such construct. For example, running the modified script that only prints the headers and values, the following, single file was used:
And here the script's output:
This shows the headers (the keys) followed by the list elements. The regex /^dataS\d\dR\d$/ matches only the column headings listed above, which have the pattern dataSnnRn, where "n" signifies a digit 0-9. Thus, the notation @{ $hash{$key} } represents the array of elements under the heading contained in $key. If you want to process a specific column, use eq instead of a regex, e.g., if ( $key eq 'dataS01R1' ) { .... This may now lead back to the original, unmodified script which generates a set of files for each processed table, as you can modify the script to fit your needs. I try running it but there's error which the script keep running without stopping. The script executes locally as expected, given the datasets you've shared. Without knowing more about your data, it's difficult to troubleshoot the problem you're experiencing. Hope this helps! In reply to Re^5: How to add column into array from delimited tab file
by Kenosis
|
|