use warnings; use strict; open my $fh1, '<', '/thisfiledoesntexist'; warn $!; open my $fh2, '<', '/etc/passwd'; warn $!; my @lines = <$fh2>; print "Read ",0+@lines," lines\n"; __END__ No such file or directory at - line 3. Inappropriate ioctl for device at - line 4. Read 45 lines