RE: Help with file stuff

2009-07-17 Thread Ken Cornetet
I think your oddball way of opening the file may be a problem (use strict complains about it). Also, you want ">" not ">>" since that says to always append your writes to the end of the file. You may want binmode as well. This appears to work use strict; use warnings; my $file = '+>mailstats.

RE: Help with file stuff

2009-07-17 Thread Wayne Simmons
I'm guessing seek won't go past the end of the file, you'll have to add logic to add "empty" records to your file in order to go that far. It is unclear from the Perl documentation on seek (as well as "man fseek") that this is the behavior, but it seems rational and the most likely reason for what

Help with file stuff

2009-07-17 Thread Barry Brevik
I'm creating a file which is just an ASCII text file, but I'm writing fixed length records into it. At any time, I need to reopen the file and write a record to a byte position calculated at run time. The write position will frequently be beyond the end of the current file length, so I need for the