in reply to valid filehandle
Sure - the filetests (-f in this case) work on filehandles as well as filenames.
if (-f $test) { print $test "It's a file"; } [download]
See perldoc perlfunc(search for -X) for more info on all the filetest operators.