http://www.perlmonks.org?node_id=1034032


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.)