in reply to Identify Unused and Uninitialised variables.
Are my $scalar; or my @array uninitialised? or are my $scalar =''; or my @array = () ?
And what about my @array = (); print $array[0];? Does every element in the array need to have some defined value to be considered initialised?
What about a hash that has keys but all values are undef? It would probably get even worse to solve if one thinks about objects or complicated structures of variables built through references.
A static analysis of the perl-code cannot find all cases of uninitialised variables.
And then, are uninitialised variables a "bad thing" per se? I doubt it.
CountZero
A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Identify Unused and Uninitialised variables.
by wfsp (Abbot) on Jan 14, 2009 at 11:00 UTC | |
|
Re^2: Identify Unused and Uninitialised variables.
by perlpal (Scribe) on Jan 14, 2009 at 12:56 UTC |