I have been working my way through several sections of Peter Wainwright's "Pro Perl." I was, in particular, interested in his approach to redirecting Perl's STDOUT and STDERR filehandles. I entered his code (see below) and got an odd result that I don't understand and, after researching it, can't find any indication of what is going on.
Here is the code snippet:
open(OLDOUT, "> &STDOUT"); my $logfile = 'MyLearn01_log.txt'; open(STDOUT, "> $logfile"); select STDOUT; <...do whatever printing to the new STDOUT...> close(STDOUT); open(STDOUT, "> &OLDOUT);
When I run this snippet I found that a file &STDOUT had been created, as well as the $logfile, MyLearn01_log.txt.
I understand, of course, why the logfile was created. But I don't understand why the file, &STDOUT, was created.
The book doesn't say anything about it (in fact my read is that no such thing should have happened).
I am running version 5.8.8.819 of ActiveState's Perl (I haven't upgraded to 5.10 yet since my IDE doesn't yet support it) under Windows XP.
Does anyone know why &SDTOUT is created?
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |