Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: uninitialized variables

by the_slycer (Chaplain)
on Mar 28, 2002 at 16:05 UTC ( #155016=note: print w/replies, xml ) Need Help??


in reply to uninitialized variables

All the above are good and probably the recommended way to do things. However, here's another option that I've used in the past.

Instead of using the -w switch, try use warnings (just like use strict). Then, in situations where you *know* that the data might not be there turn warnings off with no warnings before assigning to your variables. Once that bit of code is done, turn it back on using use warnings again.

Maybe not the best way, but convienient when you have a whole whack of variables that you might be assigning to, and don't want to initialize them all to "0".

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (4)
As of 2020-06-01 23:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (12 votes). Check out past polls.

    Notices?