I thought it's akin to 0+ which enforces scalar context and numeric casting (also in other languages like JS).
But it's basically a No-OP which separates a function from the parens, such that the parens are not interpreted as part of the function call.
It has sufficiently low precedence and doesn't meddle with context:
DB<9> say ("a".."c")[1] syntax error at (eval 18)[c:/Strawberry/perl/lib/perl5db.pl:738] line +2, near ")[" DB<10> say (("a".."c")[1]) # how it works b DB<11> say +("a".."c")[1] # avoid extra parens b DB<12> say +("a".."c")[1..2] # LIST uneffected bc DB<13>
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^3: set context for method's return values (unary plus)
by LanX
in thread set context for method's return values
by demoralizer
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |