Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: two + 2 not equal 4!

by ikegami (Pope)
on Jul 24, 2010 at 13:31 UTC ( #851167=note: print w/ replies, xml ) Need Help??


in reply to two + 2 not equal 4!

So, two + 2 is interpreted as two(2).

And that's because the following are all the same:

two + 2 two +2 two(+2) two(2)

Omitting parens around arguments can lead to weird problems. You've encountered one. You can disambiguate as follows:

two() + 2 (two) + 2

You could also add a prototype to two.


Comment on Re: two + 2 not equal 4!
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2014-12-19 06:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (72 votes), past polls