Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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 chilling in the Monastery: (11)
As of 2015-07-03 07:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (48 votes), past polls