Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: File open issue

by jwkrahn (Monsignor)
on Dec 20, 2012 at 04:13 UTC ( #1009683=note: print w/ replies, xml ) Need Help??


in reply to File open issue

my $tempfile = "$tempdir/$ENV{'REMOTE_ADDR'}";

Quotes on a bareword hash key are redundant.

open (TMPFILE, "$tempfile")|| ($nofile = 1);

You shouldn't quote variables: What's wrong with always quoting "$vars"?    You are adding extra work for perl which has to interpolate the variable and then copy its contents to the string.

Because open returns true on success or false on failure you could simply do:

my $nofile = open TMPFILE, $tempfile;
my (@tmpfile) = <TMPFILE>;

The parentheses are superfluous because an array already provides list context.


Comment on Re: File open issue
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (13)
As of 2014-07-25 19:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls