in reply to Re: What does _ mean?
in thread What does _ mean?

So how much more expensive is -e($file) && -f(_) than -e($file) && -f($file)?


holli

When you're up to your ass in alligators, it's difficult to remember that your original purpose was to drain the swamp.

Replies are listed 'Best First'.
Re^3: What does _ mean?
by tirwhan (Abbot) on Feb 04, 2009 at 17:05 UTC

    strace -tt -f -e '$file="filename";-e($file) && -f($file)'

    (as well as the alternative) says it's exactly one stat system call more expensive, unsurprisingly. Which on the system I tested it on was something like 0.0001 seconds but that will obviously vary.


    All dogma is stupid.
Re^3: What does _ mean?
by massa (Hermit) on Feb 04, 2009 at 22:59 UTC
    Four characters. Six, if you also rip out the parentheses. :-)

    Seriously, it's not just about saving one system call or half a dozen source code chars (altough I am all in favour of both) -- -d $filename && -x _ && -k _ && -u _ is simpler, cleaner, and more expressive than the alternative IMHO.

    BTW, I happen to like even more the perl6ish $filename ~~ :d & :x & :k & :u.

    []s, HTH, Massa (κς,πμ,πλ)
      In Perl 5.10, you can do
      -d -x -u $filename