Hi,
there is a
File::Remote module. It does not offer a
stat function or the -d ... operators, but might at least give you some kind of access to the file system on the other box.
You could try to open() the remote entity - if you can, it's a file, otherwise you will at least get an error message that you might be able to catch and proceed accordingly.
Update: In contrary to Net::SFTP, File::Remote uses ssh or rsh which is usually available whereas ++
blazar's solution would require an SFTP server to connect to.
On the other hand, his solution already provides functions for the test you require.
Regards,
svenXY