On Fri, Dec 17, 2004 at 09:17:05AM -0500, Chris Devers wrote: > On Thu, 16 Dec 2004, Charles K. Clarkson wrote: > > > Don't declare all your variables at the beginning > > of the script. It works in other languages, but not > > in perl. Declare them as you go.
I suppose that depends on your definition of "works". > Out of curiosity, why this rule? Locality of reference. > When taking programming classes in college, it was drummed into us that > having a data dictionary at the top of a scope was a good habit, and > it's something that I've generally done with the Perl I've written. > > Several people on this list have discouraged the habit. How come? > > I can see the logic in discouraging global variables, but predeclaring > variables at the top of a scope -- the beginning of a subroutines, and a > small handful in the main block -- still seems acceptable to me. Indeed, > waiting to declare until the variable is used is, to my thinking, kind > of defeating the point of using 'strict': if the declarations are > scattered all over the place, why bother being strict? > > Perl is an eccentric language to be sure, but why over this? Anyone care > to explain? > > Thanks :-) > > > > -- > Chris Devers > > -- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > <http://learn.perl.org/> <http://learn.perl.org/first-response> > > > -- Paul Johnson - [EMAIL PROTECTED] http://www.pjcj.net -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>