i would suggest you a logic for modifying a record in a flatfile..
first call the row on the screen for editing.
When user clicks on modify button.you should write all the records to a temporary file except the row which you want to modify.
and rename the temporary file to your orginal file name.
And finally append your modified value to the orginal file..
ie,
let us say ,
we have a file called test.txt .and it is having following records
sno|Name
--------
1|shiju
2|thomas
3|rajesh
4|james
i want to edit the sno 3 and change the name value to PETER THOMAS.
i should do the following for modifying the sno 3.
#!/usr/bin/perl
open(TEMP,">temp.txt") | | die "Error creating a file $!n";
#open a temperary file for storing the data from test.txt
open(DB,"test.txt") | | die "Error opening database $!n";
#open test.txt file
while(<DB> ){
chomp;
($sno,$name)=split(/|/,$_);
print TEMP "$_n" if $sno!="3";
#print the records to the temp.txt except sno 3
}
unlink("test.txt");
#delete the test.txt
rename("temp.txt","test.txt");
#rename the temp.txt to test.txt
#now 3rd row has been deleted from the database.
close(DB);
close(TEMP);
#now just appned the 3rd row to the test.txt
open(DB,">>test.txt") | | die "Error open database $!n";
#open database in append mode..
print DB "3|PETER THOMASn";
close(DB);
###########------#########--########
just modify the above script as per your requirment.I have not tested this script.but it should work fine...
Good Luck!!
------------------
SR -
shiju.dreamcenter.net
"The fear of the LORD is the beginning of knowledge..."
[This message has been edited by Shiju Rajan (edited May 22, 2000).]