in reply to Re^5: unquoted string error??!!
in thread unquoted string error??!!

If you don’t check return values, don’t blame Perl for errors in your code. Same with C.

Also, if you close a file twice, then that is also an error. You should have checked the return value from close both times — and every time.

Who closes files without checking to see whether it worked? That’s just begging for catastrophe.

Replies are listed 'Best First'.
Re^7: unquoted string error??!!
by runrig (Abbot) on May 04, 2011 at 22:23 UTC

    Well, I never said this (the original code anyway) was my code. And at least one other person sometimes closes files without checking the return value :-)

      Do you think that is somehow not a bug? It certainly is.

      However, whether it’s a bug only in his code, or a bug in the runtime, is a perfectly reasonable point. Anything that is absolutely required to guarantee correct behaviour is too important to be left up to programmers to forget to do correctly, and so should so should be taken care of for them.

      We’ve considered a DESTROY method that would detect and report this, fatally if autodie is enabled. There is never any reason to ignore the return of open, nor likewise that of close, because doing so makes your program just as unacceptably unreliable as a program that has “only a small” race condition would be.

      If Perl is going to go sneaking behind your back to run a close, then it needs to do it the right way, not the wrong way.

        If Perl is going to go sneaking behind your back to run a close, then it needs to do it the right way, not the wrong way.

        If you feel that way file a bug report, see perlbug