http://www.perlmonks.org?node_id=1022618


in reply to perl can find the file but can not open the file

You're using quotes where you don't need to, and as indicated above, the single-quotes in the open statement are not only unnecessary, but cause the "file not found" error. Try it like this:
die "$file not found\n" unless ( -e $file ); open( FH0, $file ) or die "Unable to open $file: $!\n"; ...
In that version, I took advantage of the fact that "open" assumes "for reading" as a default; if the file name returns "true" with '-e', then it exists. But there might still be issues with being able to read it. If '-r' returns true for the file, then it's virtually certain that "open" for reading will succeed.