eyepopslikeamosquito has asked for the wisdom of the Perl Monks concerning the following question:
To compare and report on file handles stored in various data structures, I'd like to uniquely identify a Perl file handle. I noticed that running:
produces:open my $fh, '<', $0 or die "error: open '$0': $!"; my $fh_hex = sprintf '0x%x', $fh; printf "fh='$fh' fh_hex='$fh_hex'\n";
fh='GLOB(0x202068)' fh_hex='0x202068'
So I suppose I could use $fh_hex above as a string that uniquely identifies a file handle. Is there a better way?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hex value of Perl file handle to uniquely identify
by BrowserUk (Patriarch) on Apr 09, 2016 at 06:12 UTC | |
by eyepopslikeamosquito (Archbishop) on Apr 09, 2016 at 06:48 UTC | |
by BrowserUk (Patriarch) on Apr 09, 2016 at 07:42 UTC | |
by Anonymous Monk on Apr 09, 2016 at 16:47 UTC | |
|
Re: Hex value of Perl file handle to uniquely identify
by haukex (Archbishop) on Apr 09, 2016 at 10:08 UTC | |
|
Re: Hex value of Perl file handle to uniquely identify
by james28909 (Deacon) on Apr 09, 2016 at 16:16 UTC |