Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^4: Perl fIle handles

by lidden (Deacon)
on Jun 16, 2011 at 06:21 UTC ( #909901=note: print w/ replies, xml ) Need Help??


in reply to Re^3: Perl fIle handles
in thread Perl fIle handles

Also, I'd advise against ever using the three parameter form of open when wanting read mode. It's much better to just let read mode be assumed so you don't risk putting the symbol in the wrong direction and overwriting your file.

And risk having the second arg contain something scary?
$file = '> somefile';


Comment on Re^4: Perl fIle handles
Download Code
Re^5: Perl fIle handles
by wind (Priest) on Jun 16, 2011 at 22:17 UTC

    That's a fair point, although I'm not sure I would qualify that as "scary".

    Given most of the file operations I perform are ones where I'm specifying the filename passed in the variable, I don't see this as a big risk. However, if there was ever a point where the file was specified in by the user and not validated in any way, then doing the three parameter form of read mode would be wise.

    For me at least, the right of being lazy is going to win out for this small risk otherwise. I find mistyping to be a bigger worry then intentional mischief.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://909901]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (12)
As of 2014-11-28 14:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (197 votes), past polls