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

Parens within parens [was: RE: Uploaded v2 of my bind patch, too]

Thread Next
From:
Jan Dubois
Date:
July 10, 2011 23:55
Subject:
Parens within parens [was: RE: Uploaded v2 of my bind patch, too]
Message ID:
01a001cc3f97$7fd07040$7f7150c0$@activestate.com
On Sun, 10 Jul 2011, Reverend Chip wrote:
> But it would be the first time parens *within* parens would have a
> meaning, and I'm not sure I like that.

No, there is at least one existing case already:

$ touch foo; perl -we '$_="foo"; unlink(())'; ls -l foo
-rw-r--r--  1 jan  staff  4 10 Jul 23:45 foo

$ touch foo; perl -we '$_="foo"; unlink()'; ls -l foo
ls: foo: No such file or directory

It is documented functionality, but making a distinction between passing
an empty list, or passing no arguments always felt wrong to me.  Of course
I wouldn't want unlink(@empty) to delete whatever is in $_, so I would
have preferred if unlink() had been a no-op.

Cheers,
-Jan



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