in reply to Re: Help Me!
in thread Help Me!

You should usually use the three argument form of open and lexically scoped filehandles and you should probably include the file name in the error message so you know which file failed to open.
Actually, it's quite common that it doesn't matter whether one uses 2-arg, or 3-arg open. This is one of the cases.

As for the error message, considering the program only tries to open one file, with a fixed name, it should be bloody obvious which file failed to open. "Should include the file name" is a much too strong.

Replies are listed 'Best First'.
Re^3: Help Me!
by GrandFather (Saint) on Apr 10, 2011 at 07:51 UTC

    The sooner one starts using safety nets like strictures, lexically scoped variables, full error messages and so on the more benefit one derives from their use and the more likely that such techniques will become habit. The time when such techniques are most useful is during the discovery stages of learning the language, not later on when one should know better in any case and has a better debugging toolkit to help sort problems out in any case.

    While there is a balance between introducing too much and introducing good habits early, the OP (by accident or design) is already using strictures and checking the success of open, so introducing another related three safety net techniques seems reasonable.

    True laziness is hard work