Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: how does perl handle variables

by AnomalousMonk (Monsignor)
on May 17, 2013 at 22:17 UTC ( #1034032=note: print w/ replies, xml ) Need Help??


in reply to how does perl handle variables

in this case it should ideally throw some error...

Further to Laurent_R's reply: If jabirahmed really wants to make these missteps into (fatal) errors rather than just having them generate nagging warnings, that can also be done. See perllexwarn. (Note that this control of fatality is lexical!)

>perl -wMstrict -le "print 4 + 'a'; ;; use warnings FATAL => 'numeric'; print 5 + 'b'; " Argument "a" isn't numeric in addition (+) at -e line 1. 4 Argument "b" isn't numeric in addition (+) at -e line 1. >perl -wMstrict -le "print 4 + 'a'; ;; use warnings FATAL => 'all'; print 5 + 'b'; " Argument "a" isn't numeric in addition (+) at -e line 1. 4 Argument "b" isn't numeric in addition (+) at -e line 1.

(Many Perlers favor escalating  'all' warnings to fatality. I tend to agree with this practice, especially for modules, both OO and non-OO. However, I must admit that such fatality can get annoying during debugging.)


Comment on Re: how does perl handle variables
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2014-09-01 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (11 votes), past polls