You'll need to store the filename in a string beforehand. Given a file handle, one cannot retrieve the filename without inode hopping which you're not interested in since the real solution is far simpler.
my $stringy='c:/data.txt';
open FH,">$stringy" or die;
print $stringy;