in reply to why is it considered good syntax to put \* before STDIN or STDOUT
DB<102> open $x, ">", "/tmp/tst"; DB<103> $x => \*main::$x DB<104> STDIN => "STDIN" DB<105> \*STDIN => \*main::STDIN
As you can see do lexical file handles actually hold references to globs, i.e. '\*'.
I never heard that this is generally "considered good syntax", but if you need to store "normal" file handles in variables you'll need this construction.
my $x = \*STDIN
see also perldata#Typeglobs-and-Filehandles
Cheers Rolf
(addicted to the Perl Programming Language)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: why is it considered good syntax to put \* before STDIN or STDOUT
by Anonymous Monk on Jun 08, 2014 at 15:43 UTC |