Dave Saville <da...@invalid.invalid> wrote:
> I was taught to check *anything* that produced a return code.
A rather obvious exception is the return value from print().
Once you have a properly opened filehandle, about the only thing
that can go wrong is "file system full", and if that happens, you
won't need your little Perl program to tell you that something is
wrong, because the whole 'puter will stop working. :-)
> In I
> think all perl programs I have ever seen I see opens followed by "or
> die ....."
Unless
use autodie;
> But how does one check the <> operator?
Once you know that the named version of the <> operator is readline(),
then you can just read its docs for that :-)
perldoc -f readline
If readline encounters an operating system error, C<$!> will be set
with the
corresponding error message. It can be helpful to check C<$!> when
you are
reading from filehandles you don't trust, such as a tty or a socket.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.liamg\100cm.j.dat/"
The above message is a Usenet post.
I don't recall having given anyone permission to use it on a Web site.