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

Do you agree with the statement, "-d $filename" is clearer than "-d (_)"?

No. The meaning of neither is ambiguous. You may not know what they do, but I don't see how you could possibly think they do something than what they do.

Replies are listed 'Best First'.
Re^9: What does _ mean?
by Argel (Prior) on Feb 04, 2009 at 20:46 UTC
    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

      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

Re^9: What does _ mean?
by pileofrogs (Priest) on Feb 04, 2009 at 19:15 UTC

    Okay, fair enough.

    What name would you give to the quality of code that enables one to read it quickly in poor conditions (half-asleep, drunk, etc...)?

      Clear, even quicker if it's simplistic.