Re: Perl script does not work
- From: Tim Hammerquist <penryu@xxxxxxxxxxxxx>
- Date: Sat, 29 Apr 2006 22:02:58 GMT
John Bokma <john@xxxxxxxxxxxxxxx> wrote:
Tim Hammerquist <penryu@xxxxxxxxxxxxx> wrote:
John Bokma <john@xxxxxxxxxxxxxxx> wrote:
"A. Sinan Unur" <1usa@xxxxxxxxxxxxxxxxxxx> wrote:
* Use the three argument form of open.
unless ( open my $old, '<', $file ) {
push @errors, "Failed to open '$file': $!";
next FILES;
}
Why?
Be cause there's no longer MTOWTDI.
There always is :-)
No. This is Pyth^W the New Perl. :)
(The following is *not* directed at Mr. Bokma.)
Sarcasm aside, I'm all for recommendations on
style/structure/usage. But we've started to effectively mandate
certain usage and we no longer even include reasoning.
I understand the urge to tell fresh programmers to use only
certain methods "until you know what you're doing." But we've
nevertheless started embracing the "there should be one and only
one reasonable way of doing something."
And then what have we got over Python?
CPAN? Possibly.
Autovivification? Well, that's enough for me, personally. :)
But others?
Many of Larry's and Tom's original scripts would be dismissed as
incorrect by the standards commonly used in these newsgroups.
We've been giving the same good advice for so long, many have
accepted it as law. To the point I even feel momentarily guilty
not using strictures in a 5-line script.
To bring this slightly back on topic, I can't find any place
where perlfunc says the 1- or 2-arg form of open() is
deprecated. In fact, it mentions several conveniences offered
by the 1-/2-arg form.
So when suggesting a specific structure/usage, please include
either your reasoning for why this is better in this case, or
a link so the use might learn for himself the advantages. This
promotes education (and self-education) without the stigma that
the poster's usage is "wrong." It's not. There's nothing in
that open() statement that could not be done with the
2-arg form.
YMMV,
Tim Hammerquist
.
- Follow-Ups:
- Re: Perl script does not work
- From: A. Sinan Unur
- Re: Perl script does not work
- References:
- Perl script does not work
- From: CSUIDL PROGRAMMEr
- Re: Perl script does not work
- From: A. Sinan Unur
- Re: Perl script does not work
- From: John Bokma
- Re: Perl script does not work
- From: Tim Hammerquist
- Re: Perl script does not work
- From: John Bokma
- Perl script does not work
- Prev by Date: Re: random array elements and speed
- Next by Date: Re: share a session between two website
- Previous by thread: Re: Perl script does not work
- Next by thread: Re: Perl script does not work
- Index(es):