Maybe this is to avoid the "Looks like a function" problem described in perlfunc. If you always call your functions followed by +, you probably won't fall into that trap, even when editing without care (note that under warnings perl will warn you if you make such a mistake). That's all that an unary + does anyway, it has no effect on its operand, and just changes the way perl interpretes a statement.

Also note that this + is interpreted as unary because say accepts arguments, all functions that are declared to take none (empty prototype) will turn it into an addition:

use v5.14; use warnings; use strict; sub my_say() { say $_[0] || "No arguments!"; } say (1+2)*3; # Same as (say(1+2))*3; say+(1+2)*3; # Same as say((1+2)*3); my_say+(1+2)*3; # Same as my_say()+(1+2)*3;
say (...) interpreted as function at test.pl line 10. Useless use of multiplication (*) in void context at test.pl line 10. Useless use of addition (+) in void context at test.pl line 12. 3 9 No arguments!

In reply to Re: usage of '+' sign in say statement by Eily
in thread usage of '+' sign in say statement by seki

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.