Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: _ doing something new to me?

by Lawliet (Curate)
on Feb 28, 2009 at 01:32 UTC ( #747061=note: print w/replies, xml ) Need Help??

in reply to _ doing something new to me?

It is basically the same thing as the last "thing" tested with the previous test operator but without having to re-test it (which is apparently expensive). I remember reading that in a book.

Update: I think it is called 'chaining' tests.


To save the overhead of a low-level stat() system call, Perl caches the previously-examined inode in a special variable called simply '_'; so we can do tests like this:
if ( -e $file && -r _ && -x _) { # $file exists and is both readable and executable ... }

And you didn't even know bears could type.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://747061]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2016-10-24 01:18 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (302 votes). Check out past polls.