Anno Siegel wrote:
> Paul Lalli <> wrote in comp.lang.perl.misc:
> > Anno Siegel wrote:
> > > pipe R, W;
> > > defined( my $pid = fork) or die "fork: $!";
> > > if ( $pid ) {
> > > close W;
> > > print while <R>;
> > > } else {
> > > close R;
> > > open STDOUT, '>&', fileno W;
> > > print "$_\n" for qw( gaga gigi gugu);
> > > }
> >
> > Unknown open() mode '>&' at ./fork.pl line 12.
>
> Works with 5.8.6. Alternatively, use
>
> open STDOUT, '>&' . fileno W;
Huh. Interesting. 5.8.0 gives that error. Another reason to convince
TPTB to upgrade.
> > How is that duplication of STDOUT supposed to be formed?
>
> It's the write end of the pipe that's duplicated, STDOUT becomes the
> duplicate. Otherwise, duplication of filehandles is a standard feature
> of open(), but you know that. I'm not quite sure how you mean your
> question.
I just meant I thought there was a syntax error in your code, and was
asking for a correction. (Well, there _was_.... if you were using
5.8.0, but you weren't, so there wasn't...)
Paul Lalli