Just a few code nits. Use lexical file handles and the three-argument form of open. The "||" operator in the open statement works because of the presence of parens, but the "or" operator is safer because it has a lower precedence, in case parens are not present.
"It's not how hard you work, it's how much you get done."