in reply to Adding missing values into a hash

First, your output is not exactly a CSV (comma separated value) format.

Second You would probably better off storing your metadata keys in an array rather than a hash, because an array preserves the order of the data (and not a hash).

Third, a regex might be simpler than a split if you just want to remove the trailing comma:

while (my $line = <I1>) { chomp $line; if ($line =~ /##INFO=<ID=/) { $line =~ s/,$//; # ... }
Fourth, I do not see any \t in tour input.

Fifth, reading the file twice does not seem to be a very good idea. Can't you decide, based on the content, that you have finished reading the metadata and started to read the data?

Replies are listed 'Best First'.
Re^2: Adding missing values into a hash
by Biopolete (Initiate) on Jun 19, 2014 at 14:36 UTC

    Thank you very much for your answer :)

    You are right about the csv format, I was thinking in a excel.

    I thing that storing my metadata keys in an array rather than a hash it would be better, the problem is that I don't know how to asociate the metadata in the array with the values without doing it with a hash.

    Your third and fifth points look like very interesting, but I am "noob" and i don't know how to do it :(