Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open GEN, $list question...

Status
Not open for further replies.

PerlIsGood

Programmer
Jan 24, 2002
154
US
using this code:

Code:
$list = "./blah.dat";
open GEN, $list or die "$!";

Is it possible that this file would be overwritten? I know that the default (above) is to open 'for reading', but I've just had a file accessed from a script using the above syntax get wiped, as if I'd used "> $list" instead.

Could this happen or have I possibly encountered a server hiccup...?

Note: This file is only being accessed from this one script, and is only being accessed at this one point.
 
Hi PerlIsGood,
open GEN, &quot;<blah.dat&quot;; is how I'fd normally open a file for reading

HTH
 
That syntax is normal and shouldn't have resulted in the file being overwritten. Mike
________________________________________________________________

&quot;Experience is the comb that Nature gives us, after we are bald.&quot;

Is that a haiku?
I never could get the hang
of writing those things.
 
Hi PerlIsGood,

Server's don't hiccup.
Are you the only user with access to the server?
Is any other process accessing this file? What process creates the file? Scheduled FTP? Is there a possibility that the process overwrote the file just before you accessed it?

?P
 
Actually, I found that the file 'is' accessed by another script, and this one does edit the file. The syntax was screwed and ended up wiping the file. Grrr, stoopid, stoopid typos and poor vision...

Thx for the responses all, and I'm pleased to learn that I haven't gone mad and that my server isn't out to get me. [afro] Notorious P.I.G.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top