Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: usage of '+' sign in say statement

by herveus (Parson)
on Dec 05, 2017 at 16:26 UTC ( #1204973=note: print w/replies, xml ) Need Help??


in reply to usage of '+' sign in say statement

Howdy!

The "+" forces scalar context for the call to localize_strftime. I'm not clear on the benefit of that in this specific example, given that the sub is not context sensitive.

yours,
Michael

Replies are listed 'Best First'.
Re^2: usage of '+' sign in say statement
by Eily (Monsignor) on Dec 05, 2017 at 16:49 UTC

    Unary + doesn't do anything on its operand, unlike unary - which does force scalar context:

    use v5.14; use warnings; use strict; sub array { my @array = ("Hello ", "World"); @array; } say array; say+array; say-array; # warning here say scalar array;
    Ambiguous use of -array resolved as -&array() at context.pl line 13. Hello World Hello World -2 2

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1204973]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2020-06-04 05:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (30 votes). Check out past polls.

    Notices?