Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://908521]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2017-06-26 10:49 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (577 votes). Check out past polls.