in reply to opening missing file inside eval statement

You don't show us what you actually tried. The following works for me:

if (! open INFH, "<$file") { warn "Error opening '$file': $!"; };

Replies are listed 'Best First'.
Re^2: opening missing file inside eval statement
by Anonymous Monk on Jan 08, 2011 at 22:06 UTC
    this is exactly what i tried and perl didn't catch the error when the file was missing.
    open (INFH, "<$file") {
    I only got an error later when i tried to read from it.

      What you show is not even valid Perl (or when it is, it is a snippet, meaningless in itself). Either post the minimal exact code that produces the problem for you, so we can help you better by reproducing the error ourselves. Or run the code I posted above, and look at what output it produces.