Bug#332277: perl-doc: Paragraph for open in perlfunc(1) is not clear

Niko Tyni ntyni at debian.org
Thu Apr 16 19:24:20 UTC 2015


On Mon, Apr 01, 2013 at 07:29:53PM +0100, Dominic Hargreaves wrote:
> On Wed, Oct 05, 2005 at 06:12:10PM +0200, Vincent Lefevre wrote:
> > The perlfunc(1) man page contains:
> > 
> >        In the 2-arguments (and 1-argument) form opening '-' opens
> >        STDIN and opening '>-' opens STDOUT.
> > 
> > I don't think this means anything, and there are no examples for
> > this form. Perhaps the correct word is "dup" instead of "open"?
> > And what is dupped? STDIN (resp. STDOUT) or fd 0 (resp. fd 1)?
> 
> Good questions, and I don't know the answer. That paragraph persists,
> although (noting for searchability) it's now
> 
>            In the two-argument (and one-argument) form, opening "<-" or "-"
>            opens STDIN and opening ">-" opens STDOUT.
> 
> If anyone else knows what this syntax means, do tell!

It seems to associate another file handle with STDIN/STDOUT.

% echo test | perl -e 'open(IN, "<-") and open(OUT, ">-") or die; print OUT while <IN>'  
test

Not sure how to word the docs better though.
-- 
Niko Tyni   ntyni at debian.org




More information about the Perl-maintainers mailing list