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);
In reply to Re^2: retrieve filename from filehandle?
by tirwhan
in thread retrieve filename from filehandle?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |