in reply to input data got lost in foreach loop?!

The first problem is commenting out the warnings invocation line. There maybe interesting cautionary remarks that you're removing from consideration by doing so.

I did not see any problem with my original input files. I would very appreciate if you could locate the problem.
The second problem in here is that we don't have the input files, this way you have removed a valuable insight into the possible sources of the problem, esp because you've mentioned that the code works fine for the sample files but not for the input files. If you can extract that portion of the input files that can reproduce this problem I am sure that there can be something that one of the Monks in here can provide.

I work with huge biological data files myself and I get stuck aplenty like when I extend the code from my test sample case to application on all entries for that file and just as aquarium mentioned, there may lay some unscrupulous elements that couldn't be detected in the original files during your first pass on them and can be what is causing this problem, sometimes something as small as an empty space in the wrong place can just break apart your entire program and that you needed to account

Examine your hashes by Data::Dumper to see if they contain what you expect them to in both cases for your test files and original files, read, How do I post a question effectively? and Perl and Bioinformatics for tips on how to ask questions with respect to biological data.