Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: search and extract from a large hash

by jethro (Monsignor)
on Jun 07, 2011 at 11:05 UTC ( #908448=note: print w/ replies, xml ) Need Help??


in reply to search and extract from a large hash

If I read your code correctly, you only need this:

foreach (@data_in) { chomp; $strSpec_protein_hash{$_} = $goodProteins_hash{$_}; }

This is exactly what hashes are good at and your loop is in a way removing that advantage again ;-)


Comment on Re: search and extract from a large hash
Download Code
Re^2: search and extract from a large hash
by reubs85 (Acolyte) on Jun 07, 2011 at 13:43 UTC

    Holy crap, you have no idea how much time that will save me!! I suspected all along that I was doing something daft, but I'm still getting to grips with Perl so once I'd found a way that worked i was reluctant to fiddle...

    Thanks again man

    Reuben

Re^2: search and extract from a large hash
by jwkrahn (Monsignor) on Jun 07, 2011 at 18:15 UTC

    Or just this:

    chomp @data_in; @strSpec_protein_hash{ @data_in } = @goodProteins_hash{ @data_in };

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (13)
As of 2014-10-23 16:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (126 votes), past polls