$! = 0; $line = readline $file; !defined($line) && $! and die "error readline: $!";