use Errno; $! = 0; if (-e $file || $! == Errno::EOVERFLOW) { # exists } else { # doesn't }