in reply to Read file contents
print $file and $path before opening the file to check that perl is trying to open what you think it's trying to open.
Make sure to check the open succeeded using
open FH, "<", "$path/$file" or die "can't open $path/$file: $!";
It's generally accepted that lexical filehandles are better than barewords:
open my $FH, "<", "$path/$file" or die "can't open $path/$file: $!";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Read file contents
by Anonymous Monk on Jun 29, 2008 at 16:44 UTC | |
by hilitai (Monk) on Jun 29, 2008 at 18:35 UTC | |
by psini (Deacon) on Jun 29, 2008 at 17:16 UTC |