Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: usage of '+' sign in say statement

by herveus (Prior)
on Dec 05, 2017 at 16:26 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1204973]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found