Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Perl Style: Is initializing variables considered taboo?

by dmz (Novice)
on Aug 22, 2010 at 03:36 UTC ( #856546=note: print w/replies, xml ) Need Help??


in reply to Perl Style: Is initializing variables considered taboo?

Dont forget my @this = undef; or my %that = undef; dump either and you will see that empty array element or hash element. $this[0] = update; or $that{} = undef; That's screwed up my sql inserts so may times! i now never declare unless a variable being undef is actually integral to the function of the program. $return for example Namasté Monks!
  • Comment on Re: Perl Style: Is initializing variables considered taboo?

Replies are listed 'Best First'.
Re^2: Perl Style: Is initializing variables considered taboo?
by shawnhcorey (Friar) on Aug 22, 2010 at 16:40 UTC

    You should set arrays and hashes to the empty list.

    my @this = ();
    my %that = ();

      Why?

      Have you ever had a declared array or hash not contain an empty list?

        Yes, see my above comment on mod_perl.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2016-09-25 17:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (470 votes). Check out past polls.