in reply to Re^3: What is the + in +shift doing here?
in thread What is the + in +shift doing here?

to make it clear that it's a function call, parentheses make the most sense.
Really? That's something uniformly agreed on? People write +shift for the purpose of being unclear?

I disagree. I couldn't care less whether you find parentheses or unary minus more or less clear, or what makes the most sense to you. But you will find me disagreeing with you each and every time you make such statements as if they are undeniable universal truths.

But using a + instead of the parentheses
It's not instead of parentheses. It's instead of using an argument. Or using it in a longer expression. Or instead of parenthesis around the function call. It's just one of many ways to make it not like a bareword.
  • Comment on Re^4: What is the + in +shift doing here?

Replies are listed 'Best First'.
Re^5: What is the + in +shift doing here?
by Roy Johnson (Monsignor) on Feb 24, 2005 at 16:43 UTC
    Really? That's something uniformly agreed on?
    Yes. Parentheses connote a function call. + does not.
    People write +shift for the purpose of being unclear?
    No, and I didn't say they did. They write + to be economical. The side-effect is that they are less clear.
    you will find me disagreeing with you
    That might carry some weight if you were a real Perl Monk with some reputation of your own, instead of someone hiding behind Anonymous.

    If you want to quibble about what it's instead of, it's instead of writing something that connotes a function call.


    Caution: Contents may have been coded under pressure.

      I would write shift(@_) (or, in some cases, shift @_), because I've seen too many cases where it was hard to even find where the argument handling was being done is some complex subroutines. It is nice to only search for @_ and $_[ vs. also having to search for shift without an argument or pop without an argument (the "without an argument" complicates such a visual scan considerably). Well, and I just find avoiding 2 characters to be a silly choice when it reduces code clarity.

      - tye