in reply to forgoing explicit file close

Agree .. agree .. agree .. upvote .. upvote .. upvote.

The entire process of handling a file is fraught with potential errors:   opening it, read/write, seek, and close..   Your code therefore needs to explicitly do all of it, and to explicitly check for errors.   You might have “successfully written” a bunch of data to the file, not realizing that it’s still in Perl’s buffers, when the file has gone away and the problem will not be detected until Perl attempts to write those buffers (e.g. at close time).   Even if a warning message is produced, that is not something that your program can intercept and react to ... so, that’s not good enough.   Your program will behave “mysteriously,” and that’s what causes the pager to go-off in the middle of the night or when you are having ... well, anyway ...   ;-)

Never let Perl do such things “by default.”   Code like that only works when it works.

Replies are listed 'Best First'.
Re^2:forgoing explicit file close
by 1nickt (Abbot) on Aug 23, 2015 at 15:24 UTC

    Since it's Sunday ...

    From Psycho Killer, Talking Heads, © David Byrne 1977:

    You're talking a lot, but you're not saying anything. When I have nothing to say, my lips are sealed. Say something once, why say it again?
    The way forward always starts with a minimal test.