Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: two + 2 not equal 4!

by morgon (Curate)
on Jul 24, 2010 at 02:05 UTC ( #851102=note: print w/replies, xml ) Need Help??


in reply to two + 2 not equal 4!

If you replace your last line with

printf "two + 2 = %d\n",&two + 2;

(note the ampersand) you get "two + 2 = 4". So it seems the parser treats your "two" as a bareword and converts it to 0 in numeric context (therefore the result).

I wonder why this does not procuce a warning though...

Replies are listed 'Best First'.
Re^2: two + 2 not equal 4!
by toolic (Bishop) on Jul 24, 2010 at 02:36 UTC
    So it seems the parser treats your "two" as a bareword and converts it to 0 in numeric context
    No. A bareword would generate a compile error with strict. B::Deparse shows us what's going on.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://851102]
help
Chatterbox?
[1nickt]: Corion HPs? ugh. I was impressed with Lenovo's gaming laptops; if it weren't for the red backlighting and general flashiness of the aesthetic, I might have gone with that. But all that was until I discovered that the Dell Precision line is still around.
[1nickt]: stevieb I don;t doubt that there's a difference. BestBuy has "consumer" models only on display.

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (15)
As of 2017-03-27 13:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Should Pluto Get Its Planethood Back?



    Results (320 votes). Check out past polls.