in reply to reverse engineer a filehandle
As the first answer suggested, your best bet is to make sure you store the file name at the same time you open the filehandle.
Failing that, this works on Linux, but is very non-portable:
open my $fh, '/etc/motd'; my $fd = fileno($fh); print readlink("/proc/$$/fd/$fd");
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: reverse engineer a filehandle
by smile4me (Beadle) on Dec 10, 2011 at 18:07 UTC |