in reply to *FOO{THING} syntax used on a lexical variable

After the open, $fh is a reference to an IO handle (the thing that goes in the IO slot of a glob). If you use an IO ref as if it were a glob ref, it automatically gets a new glob wrapped around it, because on a perl language level there isn't any other way to deal with it.
$ perl -wle'$x = *STDOUT{IO}; print for $x, map \*$x, 1..10' IO::Handle=IO(0x10164ce0) GLOB(0x10141190) GLOB(0x101412f8) GLOB(0x10167d4c) GLOB(0x10167d70) GLOB(0x10167d94) GLOB(0x101410ac) GLOB(0x10167e54) GLOB(0x10167e78) GLOB(0x10167e9c) GLOB(0x10167ec0)

Replies are listed 'Best First'.
Re^2: *FOO{THING} syntax used on a lexical variable
by nobull (Friar) on Jun 12, 2005 at 12:44 UTC
    After the open, $fh is a reference to an IO handle (the thing that goes in the IO slot of a glob).
    No, it's a GLOB ref.
      my $sc = <fh>;

      print $sc;
      Er, yeah, well...so it is.