http://www.perlmonks.org?node_id=1018005


in reply to Hello im new to programming i need help

You don't say exactly what's wrong with it. I didn't see any obvious bug in the code you commented out and I don't want to spend the time testing your code when you simply could tell us what exactly was wrong with it.

But I can tell you that you won't have a great performance anyway if you reread the one file once for every one of the many files as you seem to be doing.

If that one file fits into your memory, better read it first (and only once) and keep it in an array or hash.

If it doesn't fit you could create a hash on disk (for example with the help of a module like DBM::Deep) with a key made out of the comma-separated concatenation of x,y and z).