Hi
The code is working fine on my windows
7 virtual box.
I have mapped a drive to E:// and it gives me numeric output.
For the error case, I ran your code in debug mode (perl -d program.pl) and see from line 9 onwards the output of
$fs->GetDrive('Y:'); is undef.
This changes if you update the value to C:, as you pointed.
update
Is the drive you are trying to map a folder on the same machine(i used a folder on my machine so no permission / network access /privilege issues), or a network drive. If its a network drive, you might need to recheck the documentation if the invocation is right.
The temporal difficulty with perl is u need to know C well to know the awesome.else u just keep *using* it and writing inefficient code