Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Confused by '+' syntax in code sample.

by muba (Priest)
on Jun 26, 2013 at 09:05 UTC ( #1040735=note: print w/replies, xml ) Need Help??

in reply to Confused by '+' syntax in code sample.

The examples in perlfunc demonstrate this syntax quite neatly:

Any function (...) may be used either with or without parentheses around its arguments. (...) If you use parentheses, the simple but occasionally surprising rule is this: It looks like a function, therefore it is a function, and precedence doesn't matter. Otherwise it's a list operator or unary operator, and precedence does matter. Whitespace between the function and left parenthesis doesn't count, so sometimes you need to be careful:

print 1+2+4; # Prints 7. print(1+2) + 4; # Prints 3. print (1+2)+4; # Also prints 3! print +(1+2)+4; # Prints 7. print ((1+2)+4); # Prints 7.

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (1)
As of 2021-03-08 04:06 GMT
Find Nodes?
    Voting Booth?
    My favorite kind of desktop background is:

    Results (123 votes). Check out past polls.