Tom Phoenix wrote:
On 7/25/07, Johnson, Reginald (GTI) <[EMAIL PROTECTED]> wrote:

open (OMARFILE, "<junk" || die "input file cannot be openned:$!\n");

No matter what virtues your technique has or lacks, this particular
line is surely broken; it will never die, even if the file can't be
opened. Check the table of precedence in the perlop manpage. Cheers!

Wow, lots of words; no help.

Things that are not in the documentation:

 open my $omarfile, '<', "junk" or die "input file \"junk\" cannot be opened; 
$!";

Note the use of the lexical, 'my $omarfile', file handler.

Note the use of the tri-argument open.

Note the use of 'or die'.

(Note the correct spelling.)

Reading documentation is good; but it out of date with respect to best 
practices.  Reading `perldoc perlop` will not correct the errors in the 
statement.  Reading `perldoc -f open` will tell you what's possible but not 
what's the best practice.


--
Just my 0.00000002 million dollars worth,
  Shawn

"For the things we have to learn before we can do them, we learn by doing them."
 Aristotle

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to