Perl Debate Time ;-)

Arthur Corliss corliss at sinbad.net
Sat Mar 20 16:17:40 CST 1999


On Sat, 20 Mar 1999, Tony wrote:

> Use of "local" should be avoided, certainly.  However, in some cases, it
> is desirable to override Perl's default global operators.  For instance,
> if you want to put a stream filter on any <STD*> handles, "local" is
> perfect.  And since "local" variables are generally defined within the
> first few lines (usually after loading any modules), I don't think
> readabilty suffers at all.

Hmm, have you looked at the Perl Cookbook?  Seems TC likes to fork and grab
STDOUT, for output preprocessing.  What are the advantages of using local in
this instance?

> But, this is just my buck-ninety-five.  I could be wrong.  Certainly,
> "local" is misused; but in some cases, it makes coding must plain easier,
> and clearer.

There's really not a right or wrong, just programmer's preference.  :-)  I can
certainly see its uses, even though I tend to use it only for one thing.
Though I do tend to side with the critics on the readability count--sure,
coding is easier, but if the size of the program ramps up, I would be
concerned with tracking relative scope, especially with code I haven't written
myself.

	--Arthur Corliss
	  Bolverk's Lair -- http://www.odinicfoundation.org/arthur/
	  "Live Free or Die, the Only Way to Live" -- NH State Motto




More information about the Anchorage-pm mailing list