[kamloops-pm] Hello

Bradley K. Embree bke at bkecc.com
Thu Oct 9 14:38:55 CDT 2003


> -----Original Message-----
> From: kamloops-pm-bounces at mail.pm.org
> [mailto:kamloops-pm-bounces at mail.pm.org]On Behalf Of Anthonyj
> Sent: Thursday, October 09, 2003 12:20 PM
> To: kamloops-pm at mail.pm.org
> Subject: RE: [kamloops-pm] Hello
>
>
> Thankyou, I wasn't expecting such quick replies.
> Another list member had similar things to say, but sent them directly to me
> by accident, and asked me to bounce them to the list, so here it is.
>

<snip>

>
> a couple small changes. the 'my $row' is cool since it's only to be used in
> the while loop, but it's a good habit to delare/define your variables at the
> beginning of the function/sub. you should also 'use strict;', it helps tons.
> it'll complain about stuff like '$row->{ID}' and prefers "$row->{'ID'}", but
> it can save you debugging time. the -w option (if applicable), is great. or
> just set ^W.
>

<snip>

I agree with using warnings (-w or setting ^W) but I usually do that via:

	use warnings;

But of course TMTOWTDI.

One nit is that strict does not complain about bare words in the context of
hash keys (among others).

I.E. $row->{ID} is acceptable although I prefer and use $row->{'ID'} as a form
of defensive programming.

Bare words are also acceptable when declaring hashes using the => notation:

	my %hash = ( foo => 'bar' ); # ok under strict
	my %hash = ( foo, 'bar' );   # not ok under strict
	my %hash = ( 'foo', 'bar' ); # ok under strict

but once again TMTOWTDI.

Brad




More information about the kamloops-pm mailing list