-f -x -w $file

rafael on 2004-02-09T23:13:44

It's new language features time !

Since a few hours, you can now write with bleadperl:

-f -w -x $file
and perl acts as if it were
-x $file && -w _ && -f _
As I added in perlfunc, this is only syntax fancy : if you use the return value of -f $file as an argument to another filetest operator, no special magic will happen. If I remember correctly, Perl 6 will provide a full-fledged form of this syntax (with filehandle context and all). (To be appearing in the next p5p summary...)


Yay!

clscott on 2004-02-10T14:14:19

I love it! Thank you.

How about extending _ to mean the article passed to the previous test to apply to other tests?

if ( exists $foo->{member} and defined $foo->{member}) {}

becomes

if ( exists $foo->{member} and defined _ ) {}

It's now just a little shorter ...

Re:Yay!

vsergu on 2004-02-13T12:45:33

That would break existing programs. Besides, it's not equivalent to the file tests, since you're not caching the info needed for future tests when you do the first one.