Edit two files?

They have: 45 posts

Joined: Aug 2000

I want to open and edit two files in the same action. (or one right after the other). For some reason perl only allows me to edit the first one. Does anyone know why this may be? My code looks like:

open (guest, ">>book.file") || die "Cannot open file: $!\n";
flock(guest,2);
print guest "$entryline";
unlock(guest);
close (guest);

open(count, "counter.file")|| die "Cannot open file: $!\n";
$count=;
close(count);

$count++;

open(count, ">counter.file") || die "cannot open file: $!\n";
flock(count,2);
print count "$count";
unlock(count);
close(count);

Thanks!

Laguna Loire
Site Director: Laguna's Jukebox (http://jukebox.3dstream.net)
Site Admin: RPGBoards (http://rpgboards.3dstream.net)

They have: 568 posts

Joined: Nov 1999

I see you started to post outside of the RPG Boards. Smiling

Is the second file chmoded 777?

They have: 45 posts

Joined: Aug 2000

Our server dosnt require cmoding to execute cgi scripts or edit files. The first file was never cmoded, however it edited it.

I do post outside, on SEVERAL message boards!

Laguna Loire
Site Director: Laguna's Jukebox (http://jukebox.3dstream.net)
Site Admin: RPGBoards (http://rpgboards.3dstream.net)

They have: 193 posts

Joined: Feb 2000

Remove the unlock commands...I am suprised PERL isn't giving you a 500 Error: unlock is a delete command, not the reverse of flock.

Richard

They have: 568 posts

Joined: Nov 1999

richjb, your confused. unlock is the right way to unlock the file. unLINK is the delete command.

They have: 193 posts

Joined: Feb 2000

You're right.

Richard

They have: 568 posts

Joined: Nov 1999

if your server doesn't support chmoding then chances are it wont support flock.

are you talking about the 3dstream server?

They have: 45 posts

Joined: Aug 2000

It supports cmoding, however I dont have too to run a perl script. I have cmoded files before to remove outside access to them. And yes, this is the 3dstream server

Laguna Loire
Site Director: Laguna's Jukebox (http://jukebox.3dstream.net)
Site Admin: RPGBoards (http://rpgboards.3dstream.net)

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.