smile4me has asked for the wisdom of the Perl Monks concerning the following question:
According to http://perldoc.perl.org/perlopentut.html: "Indirect filehandles also make it easy to pass filehandles to and return filehandles from subroutines."
Okay, so how do I find out which file this filehandle references? If the file name is dynamically generated, and all I have is a filehandle, how do I know which file is being written into?
For example:Thanks,#get a filehandle $fh = get_fh_from_file( generate_filename() ); if ( print_data( $fh, $data ) ) { say "data printed to file: $fh"; } ## got: data printed to file: *TRSC::FileUtils::FH; ## expected: '/path/to/file'
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: reverse engineer a filehandle
by tobyink (Canon) on Dec 09, 2011 at 23:17 UTC | |
by smile4me (Beadle) on Dec 10, 2011 at 18:07 UTC | |
|
Re: reverse engineer a filehandle
by TJPride (Pilgrim) on Dec 09, 2011 at 22:55 UTC | |
|
Re: reverse engineer a filehandle
by JavaFan (Canon) on Dec 10, 2011 at 18:47 UTC |