in reply to Passing a file handle to a sub. I still don't get it.
What you saw is the stringification, which is not necessarily the same thing. For instance:
But if instead I use x to peek at the globref in the debugger, it looks like this:my $x = \*FH; print "plain glob ref: <$x>\n"; # prints: plain glob ref: <GLOB(0x1d6c660)> open ($x, "<","somefile") or warn "error\n"; print "open FH ref: <$x>\n"; # prints: open FH ref: <GLOB(0x1d6c660)>
...which is much more interesting.my $x = \*FH; x $x # prints: #0 GLOB(0x1d6c408) # -> *main::FH open ($x, "<","somefile") or warn "error\n"; print "open FH ref: <$x>\n"; # prints: 0 GLOB(0x1d6c408) -> *main::FH FileHandle({*main::FH}) => fileno(6)
What do you get in your code?
-QM
--
Quantum Mechanics: The dreams stuff is made of
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Passing a file handle to a sub. I still don't get it.
by rvosa (Curate) on Jun 09, 2005 at 19:21 UTC | |
by QM (Parson) on Jun 09, 2005 at 21:04 UTC |