Example 6-3. examples/files/open_missing_file.pl
#!/usr/bin/perl
use strict;
use warnings;
if (open my $fh, '<', "nosuch") {
# should do here something
} else {
warn $!;
}The error message we get:
No such file or directory at examples/files/open_missing_file.pl line 7.
| Prev | Home (Copyright Gabor Szabo) Perl Training Israel | Next |
| Opening a file - error handling | Up | Read one line from a file |