Hi monks, I'm trying to check whether a filehandle from
open is valid after the call. If the filehandle is valid,
I want to use it to print with, if it is not I want
to do something else. For some reason, the below code
segment doesn't work. It always goes to the else
part of the code.
open($test, "<test.txt");
if (!$test) {
#do something
} else {
#use $test to print something
}
I know i can do this:
open($test, "<test.txt") || die("$!\n");
but i really need to check for a valid filehandle
after the open is complete. Is there a way to
do this?
thanks,
Michael