develooper Front page | perl.perl5.porters | Postings from July 2011

Re: [PATCH] [DOCS] Modernize perlopentut.pod

Thread Previous | Thread Next
From:
Tom Christiansen
Date:
July 19, 2011 23:53
Subject:
Re: [PATCH] [DOCS] Modernize perlopentut.pod
Message ID:
5157.1311144800@chthon
>* David Golden <xdaveg@gmail.com> [2011-07-18 22:40]:
>> As Tom points out, there is no problem with 2-arg open if *you*
>> control all the arguments and know what you're doing. The
>> rationale for 3-arg open is (IMO) that it's less error-prone.

>2-arg open is also useful when you don’t *want* to control all
>inputs, such as giving a caller the option to ask for transparent
>decompression by piping from zcat instead of reading from a file.


No, two-arg open is perfectly fine here:

    open(STDOUT, "> /dev/null")

It's all constants.  We know exactly what's going on.

And 

    open(STDOUT, "> $fn")

is only marginally worse, because of the whitespace issues.

--tom

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About