On Tue, Jul 10, 2001 at 10:19:43AM -0700, Paul wrote:
> open THIS, ">&THAT"
This dups (see man 2 dup) fileno(THAT) and opens it with the filehandle
THIS. The THIS and THAT filehandles now refer to the same file descriptor,
and thus the same underlying file.
> *THIS = *THAT
This aliases all symbols named THIS to THAT. This means \$THIS eq \$THAT,
\%THIS eq \%THAT, \@THIS eq \@THAT, etc. (yes, I meant to take the
references to these values, in order to indicate they are aliases, different
names for the same values) and the filehandles THIS and THAT go to the same
file.
> Doesn anybody know the difference?
> Especially if you use STDERR and STDOUT instead of THIS and THAT?
The primary difference is that "*THIS = *THAT" are only visible from Perl,
they (for reasons that should be obvious if you think about it) don't
propagate to any external processes. Meaning, if you want to redirect
STDERR and STDOUT for a subprocess you have to use the dup, or the fdopen
(<&=fd), form of open, or equivalent.
MIchael
--
Administrator www.shoebox.net
Programmer, System Administrator www.gallanttech.com
--