That clearly indicates that EOF and a readline error can be distinguished by undefining $! before the call and then, if readline failed, checking if $! is set to non-0.for (;;) { undef $!; unless (defined( $line = <> )) { die $! if $!; last; # reached EOF } # ... }
In reply to Re^2: Best way to handle readline errors?
by jrw
in thread Best way to handle readline errors?
by jrw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |