Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

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.



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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (7)
As of 2016-02-12 23:46 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (415 votes), past polls