in reply to My habitual errors
I get a couple with open. These days, I've expunged globs from my file handling code, and now use lexicals exclusively. That is, I write:
open my $fh, '<', $file or die...
as opposed to
open IN, '<', $file or die ...
so the mistake I find myself now making regularly is:
my $fh = open # *pauses*
and I realise I've messed up and start the line over. Still, at least I catch that as I'm writing it. This is an improvement over the previous situation, where I would regularly write:
open IN "< $file" or die ...
And not spot anything was amiss until I ran the code and the compiler complained about syntax errors. Some say that's progress...
• another intruder with the mooring in the heart of the Perl
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: My habitual errors (are with open)
by Moron (Curate) on Apr 05, 2007 at 14:48 UTC |