http://qs1969.pair.com?node_id=814812

romandas has asked for the wisdom of the Perl Monks concerning the following question:

Not trying to do anything "useful" here, just experimenting with Perl a bit. I read in Intermediate Perl (p. 146) that the print function (as well as many of the built-in operations on filehandles) are actually just using Perl's indirect object notation to call the print method on the filehandle object.

So, I was curious to see whether this worked with the standard filehandles; STDOUT in particular. However:

my $ofh = *STDOUT; $ofh->print("test 1\n");

didn't work. Nor did:

my $ofh = \*STDOUT; $ofh->print("test 2\n");

or even (not that I expected this to):

STDOUT->print("test 3\n");

So, what gives? I checked perlfaq5, IO::Handle, and perldata but didn't see anything that answered my question specifically. Is there something I'm doing wrong or are the STD* filehandles "special" in some way?

Update: Thanks, all!