Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: To initialise or not to initialise?

by rinceWind (Monsignor)
on Jun 24, 2004 at 10:34 UTC ( #369279=note: print w/replies, xml ) Need Help??

in reply to To initialise or not to initialise?

If you are not initialising the variables, they take the value undef. There are many cases when I specifically test for this:
if (defined $foo) { .... }
This is very different from C, where the contents of your variable are arbitrary and could contain complete garbage.

Perl has a nice pragma called "use warnings", which spots when I have been to lazy to initialize any scalar variable I am trying to use.

I'm Not Just Another Perl Hacker

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2021-10-27 23:48 GMT
Find Nodes?
    Voting Booth?
    My first memorable Perl project was:

    Results (95 votes). Check out past polls.