in reply to Cannot open file within a loop
The current directory does not change when you open a folder handle, and I suspect that use warnings; must warn about this.
Your open (READ, "$file") || die "Cannot open $file: $!.\n"; must be changed into open my $readfh,'<', $dir.'/'.$file or die "Cannot open $dir.'/'.$file: $!.\n";
You can check if I'm right testing the file for existence just before trying to open it: warn "File [$file] not found" unless -e $file;
L*
|
|---|