in reply to Assign IP address to some drive
Some variation on subst u: \\12.13.12.345\c$ should do the trick.
And an unadorned subst will show you which substitutions are currently in force.
From Perl, just use the above with system or a piped open.