in reply to Batch process LWP search

You didn't post the part of the code that has the bug. Try applying strict and warnings to your script. When you've fixed it so it passes both, you may have found your problem. You'll certainly have better code. As-is, you're using lots of globals and declaring little and that's often a bad sign.