in reply to Re^2: Print entire line
in thread Print entire line
ok,
my $filename = '/Users/Pabli/Desktop/do_human_mapping.gmt'; my $match = 'DOID:2055'; open(my $file, '<', $filename) or die "open: $!"; while (<$file>){ my ($name,$id,@genes) = split /\t/; print join("\n",@genes) if $id eq $match; }
The answer to your question then, is to use the assignment idiom above, to name the first two fields, and then use an array to slurp up all the genes that follow on the line. Because the name and id never get lumped into the @genes array, you don't have to go through contortions when it comes time to print.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Print entire line
by pabla23 (Novice) on Nov 06, 2014 at 11:59 UTC | |
|
Re^4: Print entire line
by pabla23 (Novice) on Nov 06, 2014 at 13:49 UTC | |
by Loops (Curate) on Nov 06, 2014 at 14:32 UTC | |
by pabla23 (Novice) on Nov 06, 2014 at 15:15 UTC |