rattytatty has asked for the wisdom of the Perl Monks concerning the following question:
use warnings; use strict; my %hash; open FILES,"Final.txt"or die "Can not open file"; while(<FILES>){ chomp $_; my @words; @words=split(/\t/,$_); my $len=scalar(@words)-1; $hash{$words[$len]}=$words[0]; } open FILE,"output.txt" or die "Can not open file";<br> open OUT, ">cladeST.txt" or die "Can not open file Final.txt"; while(<FILE>){<br> chomp $_; my @word; @word=split(/\t/,$_); print OUT "$_\t$hash{$word[-1]}\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with hashes
by Ratazong (Monsignor) on Feb 09, 2012 at 14:52 UTC | |
by rattytatty (Initiate) on Feb 09, 2012 at 15:06 UTC | |
by Ratazong (Monsignor) on Feb 09, 2012 at 15:16 UTC |