in reply to hash lookup

%GID = map { $temp[0] => $temp[1] } @temp;

This assigns two elements to %GID, throwing away all other items in that hash that might been in there before. Not what you want. Instead, just write $GID{$temp[0]} = $temp[1].

There's also no reason to build the @list1 and @list2 arrays. Finally you can get rid of %GID completely by first iterating over <FH2> and building %CVDgenes, and then iterate over <FH1> directly.

Perl 6 - links to (nearly) everything that is Perl 6.

Replies are listed 'Best First'.
Re^2: hash lookup
by dr_joe (Initiate) on Oct 12, 2009 at 22:00 UTC
    Thanks, Moritz.

    At your leisure, would you kindly give me a bit more detail about how to approach the last part of your suggestions (getting rid of %GID completely)?

      There's really not much detail to be given. Currently you iterate over one file, store all elements in a hash, and later on you iterate over all the data in the hash.

      Unless you need the hash for weeding out duplicates, you simply iterate over the data that you would have put into th hash when you need it.

      Perl 6 - links to (nearly) everything that is Perl 6.