The best way to do this is using Win32::Lanman and connecting to the IPC$ share of the server. The IPC$ share let's you establish a security token with the remote server, without limiting yourself to a particular share. Then you can test for the existence of that file using UNC paths.
An example:
use strict;
use Win32::Lanman;
my $result = Win32::Lanman::NetUseAdd({
remote => "\\\\yourserver\\ipc\$",
password => "yourpass",
username => "youruser",
domain => "yourdomain",
asg_type => &USE_IPC
});
if (! $result) {
print "Sorry, something went wrong; error: ";
print Win32::Lanman::GetLastError();
exit 1;
}
#test for file existence
if (-e "\\\\yourserver\\c\$\\winnt\\system32\\myfile.dll") {
print "File exists\n";
} else {
print "File does not exist\n";
}