On Sat, Apr 03, 2004 at 11:53:59AM -0800, R. Joseph Newton wrote:

> Paul Johnson wrote:
> 
> > $_ = "Leave me alone!";
> > $s = "0";
> 
> Better yet:
> $lower_or-mixed_case_string = 'o';

I worry that you may have missed the point of the example, which was the
value of the variable being passed into the to_upper subroutine.  That
has since been discussed elsewhere in this thread, but you could argue
that I should have been more explicit.

> > to_upper $lower_or-mixed_case_string;

s/-/_/ ?

> With intelligent use of the editing facilities available, extra characters do
> not cost much.

Correct.  Steve McConnell had a review draft of his chapter on naming
variables online, but now you'll have to wait for the second edition of
Code Complete to come out before you can read it.

A couple of interesting points he makes on variable name length are that
the length of a variable name should reflect the scope of the variable.
A short variable name is fine in a restricted scope.  For a larger
scope, use a longer name.  I always start global variables with a
capital letter.

He also mantions that i is often a very good name for a loop variable in
a restricted scope.

The first edition was very good.  The second looks like it will be even
better.

-- 
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>


Reply via email to