On Aug 29, Brent Clark said:
Would someone be so kind as to please over look me code and if possible, point
out where I am going wrong.
Would you be so kind as to explain what happens with it that you didn't
expect to happen? (Or what doesn't happen that you'd expected to happen.)
open(HDATFILE, "+< $fileName.dat") or die "Cant open file $fileName.dat $!";
flock (HDATFILE, LOCK_EX) or die "Cant lock file $fileName.dat $!";
Make sure you're including the Fcntl module for the LOCK_EX constant.
my $writePos = 0;
while (<HDATFILE>){
my $readPos = tell HDATFILE;
if(m/^p11[016]/io){
$found110 = 'y' unless m/^p110/i;
$found111 = 'y' unless m/^p111/i;
$found116 = 'y' unless m/^p116/i;
seek HDATFILE, $writePos, 0;
print HDATFILE &compareRmNames($fileName, $_);
$writePos = tell HDATFILE;
seek HDATFILE, $readPos, 0;
Unless you are writing the EXACT SAME NUMBER OF BYTES to the file, you are
going to either over-write or under-write content.
You're probably better off using a temporary file, or Perl's "in-place"
editing.
--
Jeff "japhy" Pinyan % How can we ever be the sold short or
RPI Acacia Brother #734 % the cheated, we who for every service
http://japhy.perlmonk.org/ % have long ago been overpaid?
http://www.perlmonks.org/ % -- Meister Eckhart
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>