in reply to search and extract from a large hash
A few further points to note:-
Use the three-argument form of open with lexical file handles and check for success, giving the o/s error on failure, e.g.
open my $uniqueFH, '<', $uniqueFile or die "open: < $uniqueFile: $!\n";
You can do your chomping in one fell swoop
chomp( my @data_in = <$uniqueFH> );
rather than piecemeal.
You could consider using a hash slice rather than looping although this might not be practicable with very large data sets
my %strSpec_protein_hash; @strSpec_protein_hash{ @data_in } = @goodProteins_hash{ @data_in };
I wonder if you have a cut'n'paste error in your post, my %strSpec; versus $strSpec_protein_hash{$id} = $seq;
I hope these points are helpful.
Cheers,
JohnGG
|
|---|