in reply to Data extraction from hash problem

I think your question has been answered pretty thoroughly... I'd like to point out that it's a phenomenally good idea to ensure that there is only one point of entry for any bit of information you need to keep track of in a program...

Setting up the $ValidTest variable is a good idea... but if you'd used it throughout the script, instead of the multiple instances of '8594', you might have spotted one of the issues much sooner. Or simply not had it.

I don't mean to be critical, just helpful... I found that, particularly for long chunks of code, my life was made much simpler when I went on a 'multiple-point-of-data-entry jihad'. I believe there is a lot of good, solid research on this.... I just can't point you to it at the moment :) Pragmatic Programmer has a section or four discussing this, now that I think about it. Good book to read straight through too.

markguy