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;
Done.
AgentM Systems nor Nasca Enterprises nor
Bone::Easy nor Macperl is responsible for the
comments made by
AgentM. Remember, you can build any logical system with NOR.