in reply to Reading multiple files one line at a time from arguments
which tells you which file you failed to open (this makes your life easier when you need to open a dozen files and one is missing, or when your program is constructing the file names by assembling various parts of such names). Aside from that, there is also the question whether you really want your program to fail if just one file is missing; this is usually what I want to do in such a situation, but there are some rare cases where I would just want a warning rather that a failure if just one file is missing from a long list of files.open my $fh, "<", "$file" or die "Cannot open file $file: $!";
|
|---|