Robert's Perl Tutorial
It fails. That's not so bad, everything fails sometimes. What is unforgivable is NOT CHECKING THE ERROR CODE !
This is a better version:
open STUFF, $stuff or die "Cannot open $stuff for read :$!";
or means that the code on
the RHS (right hand side) is evaluated. Perl dies. This means it exits the
script, performs a post-mortem which it writes up into
$! and tells
you the line number at which it died. Just because
$! contains useful
information doesn't mean to say it is automagically printed, in true perl
fashion. Usually you will wish to avail yourself of the information inside as
it is of great help when working out why something is not going according to
plan. The moral of the chapter is:
Always check your return codes !