Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: search and extract from a large hash

by jethro (Monsignor)
on Jun 07, 2011 at 11:05 UTC ( [id://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 ;-)

Replies are listed 'Best First'.
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 (Abbot) 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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://908448]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2024-03-19 09:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found