Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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?
Re^2: Perl Style: Is initializing variables considered taboo?
by shawnhcorey (Pilgrim) 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 meditating upon the Monastery: (13)
As of 2014-09-17 14:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (82 votes), past polls