develooper Front page | perl.perl5.porters | Postings from August 2009

Re: [DOC] Modernization: perldata

Thread Previous | Thread Next
Flavio Poletti
August 30, 2009 04:05
Re: [DOC] Modernization: perldata
Message ID:
On Sun, Aug 30, 2009 at 12:03 PM, Ben Morrow <> wrote:

> Quoth (Flavio Poletti):
> >
> > -    $who = "Larry";
> > -    print PASSWD "${who}::0:0:Superuser:/:/bin/perl\n";
> > +    my $who = "Larry";
> > +    print $passwd_fh "${who}::0:0:Superuser:/:/bin/perl\n";
> (I'm being picky again, and I don't like it. Please tell me to stop when
> it gets annoying.)

I think that being picky might help in general, it could unveil things that
the corrector didn't think of.

I usually stick to the convention of using uppercase for filehandles,
> even when they're in variables. It just helps visually distinguish them.
> I'd write this
>    print $PASSWD "...";

Sloppily applying your logic for the other correction (the one about the
quotes in hashes keys) I'd say that I never saw anything like this in the
docs: everywhere they use lexical variables for filehandles, they are
lowercase. Sloppily here means that I won't likely verify my statement on
the whole documentation base :-)

On the other hand, I agree with H.Merjin Brand about using a simple $fh
here; anything else would distract attention from the real topic, i.e. using
braces to access variables' contents. I also think that using lexical
filehandles generally allows you to "anonymize" the corresponding variable
name to a simple $fh, due to the (generally) restricted scope, so I'd
probably use $fh even in production code.



Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About