smackdab has asked for the wisdom of the Perl Monks concerning the following question:
use Fcntl qw(:DEFAULT :flock); if (open(FILE, "+< stuff.txt")) #if (sysopen(FILE, "stuff.txt", O_RDWR)) { # if (flock(FILE, LOCK_EX|LOCK_NB)) { local $/ = undef; my $buff = <FILE>; # my $buff = ''; # sysread(FILE, $buff, -s FILE); # DO STUFF TO $buff HERE, can GROW or SHRINK # Split it into pieces... seek(FILE, 0, 0); print FILE, $top_of_buffer; print FILE, $new_stuff; print FILE, $bot_of_buffer; close(FILE);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: file updating question
by Thelonius (Priest) on Nov 28, 2002 at 02:14 UTC | |
by smackdab (Pilgrim) on Nov 28, 2002 at 03:03 UTC | |
|
Re: file updating question
by pg (Canon) on Nov 28, 2002 at 02:12 UTC | |
|
Re: file updating question
by rbc (Curate) on Nov 28, 2002 at 05:00 UTC |