in reply to -localtime +gmtime
$ perl -MO=Deparse -e 'print +localtime' print localtime; -e syntax OK $ perl -MO=Deparse -e 'print -localtime' print -localtime; -e syntax OK
The + can be used to tell the parser that something isn't part of a function call, it's not a way to tell perl this is a number. We've just discussed this in Re: Split returning one element.
In Perl 6 it is a bit different: foo(..), $x is always parsed a function call, followed by a comma and $x, whereas foo (...), $x is parsed a function call which receives both the parenthesis group and $x. That leaves the unary + free to force numeric context.
|
|---|