I'm surprised you're getting any output. You're first while loop iterates over the entire file, populating %starthash. By the time the second while is encountered, there's nothing more to read, so its body is not executed once. But that's where the print statement is.
Hi.
I apologize for this. I removed the close(input file) and again, open (input file) commands by mistake.
I do do that, and that's not the real problem.
Again, my apologies. Will be more careful.