in reply to Re: retrieve filename from filehandle?
in thread retrieve filename from filehandle?
A slightly more cross-platform way of doing this (works on most Unixes) would be to use lsof. The following will first determine the file descriptor from the filehandle (as per zentara's example) and then uses this file descriptor to find the file name.
my $desc = fileno($handle); my $name = (`lsof -Fn -a -d $desc -p $$`)[1]; $name = substr($name,1);
|
|---|