Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: search and extract from a large hash

by johngg (Abbot)
on Jun 07, 2011 at 16:16 UTC ( #908521=note: print w/ replies, xml ) Need Help??


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


Comment on Re: search and extract from a large hash
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://908521]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (11)
As of 2014-12-22 09:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (114 votes), past polls