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

Re: [DOC] Modernization: perldata

Thread Previous
From:
H.Merijn Brand
Date:
August 30, 2009 03:39
Subject:
Re: [DOC] Modernization: perldata
Message ID:
20090830123933.7bf59877@pc09.procura.nl
On Sun, 30 Aug 2009 11:03:03 +0100, Ben Morrow <ben@morrow.me.uk> wrote:

> Quoth polettix@gmail.com (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 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 "...";

Personally, I would just use '$fh'. It's an *example*, not production
code. This example tries to explain why $who should be embraced. I
agree with Rafaƫl that the my is not suitable here. I think BPP prefers

  print { $fh } "...";


-- 
H.Merijn Brand  http://tux.nl      Perl Monger  http://amsterdam.pm.org/
using & porting perl 5.6.2, 5.8.x, 5.10.x, 5.11.x on HP-UX 10.20, 11.00,
11.11, 11.23, and 11.31, OpenSuSE 10.3, 11.0, and 11.1, AIX 5.2 and 5.3.
http://mirrors.develooper.com/hpux/           http://www.test-smoke.org/
http://qa.perl.org      http://www.goldmark.org/jeff/stupid-disclaimers/

Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About