variable declaration, was RE: moving to the next line
From: Chris Devers (cdevers_at_pobox.com)
Date: 12/17/04
- Next message: DBSMITH_at_OhioHealth.com: "remote install of TSM backup client on a windows xp or 2000 machine"
- Previous message: Charles K. Clarkson: "RE: CGI-HTML printing error"
- In reply to: Charles K. Clarkson: "RE: moving to the next line"
- Next in thread: Jonathan Paton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Jonathan Paton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Paul Johnson: "Re: variable declaration, was RE: moving to the next line"
- Maybe reply: Lawrence Statton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Charles K. Clarkson: "RE: variable declaration, was RE: moving to the next line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 17 Dec 2004 09:17:05 -0500 (EST) To: "Charles K. Clarkson" <cclarkson@htcomp.net>
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.
Out of curiosity, why this rule?
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
- Next message: DBSMITH_at_OhioHealth.com: "remote install of TSM backup client on a windows xp or 2000 machine"
- Previous message: Charles K. Clarkson: "RE: CGI-HTML printing error"
- In reply to: Charles K. Clarkson: "RE: moving to the next line"
- Next in thread: Jonathan Paton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Jonathan Paton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Paul Johnson: "Re: variable declaration, was RE: moving to the next line"
- Maybe reply: Lawrence Statton: "Re: variable declaration, was RE: moving to the next line"
- Reply: Charles K. Clarkson: "RE: variable declaration, was RE: moving to the next line"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|