in reply to tips on how to speed up a very slow perl script requested

If you use a hash lookup in the inner loop instead of iterating over all the elements of the second first, you can get a huge speed gain. See perldata for more information about hashes.
  • Comment on Re: tips on how to speed up a very slow perl script requested

Replies are listed 'Best First'.
Re^2: tips on how to speed up a very slow perl script requested
by Angharad (Pilgrim) on May 06, 2009 at 14:51 UTC
    Yes, I tried that but it wasn't very successful (seeing as my grasp of hashes is rather pathetic)
      Here is what you need to do:
      1. Declare a hash
      2. Read the first file line by line, populating the hash
      3. iterate over the second file, and look up the values in the hash

      In your current program, you compare things to $pdbchain, so your hash keys have to be constructed exactly in the same way as $pdbchain

      Give it a try, and when you have problems, come back with more specific questions.

      Please, when you have an instance like this, post your code. Doubtless someone here can find and correct the error. If you can't post it because it's long since been over-written, I'd suggest you look into a Version Control System. Sometimes good approaches get discarded because a detail or two gets in the way.

      HTH,

      planetscape