Mr. Shawn H. Corey wrote:

Rob Dixon wrote:

What I recommend instead is

 open OMARFILE, 'junk' or die "Input file cannot be opened: $!";

The recommended usage of open is:

open my $omarfh, '<', 'junk' or die "Input file 'junk' cannot be opened: $!";

The three argument is preferred as a malicious user could enter a file name that starts with '>'

The lexically scoped file handler is preferred since it won't interfere with other file handlers.

Sure, I agree Shawn, but I also think it's nice to change the OP's code
as little as possible to turn it into something that works as well as
possible.

Plus most of the published literature still uses bareword filehandles
and offering something different unnecessarily complicates things for
beginners.

And there is no way that line of code could be compromised so the mode
parameter is unnecessary.

Rob

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


Reply via email to