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

thus should be avoided unless there is a good reason for it.

What should I use instead, a class people would have to look up anyway?

Remember, it's not -d _ vs -d $filename. They don't do the same thing. It's -d _ vs $stat->mode & 0170000 == 040000 or something that's not even part of Perl.

Replies are listed 'Best First'.
Re^11: What does _ mean?
by Argel (Prior) on Feb 04, 2009 at 21:14 UTC
    But if performance is not an issue then the underscore is not really needed, and thus -d $filename and -d(_) would in effect give the same result, right? Based on merlyn's response below there is virtually no reason to use the underscore anymore.

    Elda Taluta; Sarks Sark; Ark Arks

      Based on merlyn's response below there is virtually no reason to use the underscore anymore.

      Except

      if ( -r -w -e -f $file and -s _ > 2300 ){ print "found a candidate\n"; }
        This thread has been about whether avoinding a second call to stat for a trivial performance gain is worth it or if it's better to use $file twice so that people reading the code do not have to try and figure out what the obscure "_" feature does. Unless using "_" in this context results in some other behavior beyond saving a call to stat you have contributed nothing new to this discussion/debate!!

        Elda Taluta; Sarks Sark; Ark Arks