|Just another Perl shrine|
Adding missing values into a hashby Biopolete (Initiate)
|on Jun 18, 2014 at 19:05 UTC||Need Help??|
Biopolete has asked for the
wisdom of the Perl Monks concerning the following question:
I' m trying to convert a column to a csv file.
My data looks like:
And I want a csv like this:
AC AB AC
1 2 3
2 2 NA
5 1 1
First of all I do a hash obtaining the keys from the metadata (##)
Now I have my hash info with my keys (AA, AB, AC)
Then I want to introduce the values.
I start with:
That is because I want to eliminate \t and ;
But I don't know how to introduce the missing values (NA)
I want something like this:
AA => 1,2,5
AB => 2,2,1
AC => 3,NA,1
Anyone knows how to introduce the NA string in its correct position?? (my real file is much bigger with a lot of NA)
Thank you very much.