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

Re: New feature proposal : <<>> to disable magic open of ARGV

Thread Previous | Thread Next
Rafael Garcia-Suarez
July 24, 2014 20:06
Re: New feature proposal : <<>> to disable magic open of ARGV
Message ID:
On 24 July 2014 19:13, Ricardo Signes <> wrote:
> * Rafael Garcia-Suarez <> [2014-07-24T11:51:40]
>> I believe that this was discussed here some years ago, and that this
>> was suggested by TomC. Anyway, I pushed a patch on rgs/nomagicopen.
>> The patch is incomplete as it lacks docs and tests. I welcome feedback
>> on the intent of the feature.
> Gut reaction after 30s while sitting in a conference session:
> I like the feature, but I think it might be too small a change to pick up a new
> operator.  What about a pragma/feature?

It's more syntactic sugar than new operator. That said, there are benefits
and drawback in the 2 approaches.

Con: The syntax is backward-compatible, so technically we don't *need* a new
pragma to enable it. <<>> optimises for less verbosity.

Pro: However on one-liners without a pragma we lack a way to transform the
implicit while(<>) of -n or -p into a while(<<>>).

Pro: A pragma could also disable the magic in eof() (the one with empty

So what would be a pragma name ? secure::open ? open::nomagic ?

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About