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

The "problem" is that the underscore in this case is an obscure feature. Most people will understand -d $filename while many will have to look up what the underscore does before they understand what -d (_) does. Use of obscure features makes code harder to understand and thus should be avoided unless there is a good reason for it. At least I think that's what pileofrogs meant.

Elda Taluta; Sarks Sark; Ark Arks

Replies are listed 'Best First'.
Re^10: What does _ mean?
by ikegami (Patriarch) on Feb 04, 2009 at 20:49 UTC

    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.

      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"; }