maybe a more illustrious monk had a different perspective, but you should probably open the external file like this ...
open (FOO,'/home/foo.txt');
it should be fairly straightforward simply to delete the current records in the table and repopulate it ... i.e.,
$dbs=$dbh->prepare("delete from foo");
$dbs->execute;
and then simply loop through the <FOO> file splitting the line and inserting the new records, like
while <FOO> {
$line=<FOO>;
@values=split $line;
(then do whatever your favorite flavor of record insertion is, such as..)
($val1,$val2,$val3 ...) = @values;
$dbs=$dbh->prepare("insert into foo set val1=$val1,val2=$val2 ...);
$dbs->execute;
}
you may want to take a look at my post on "mysql and postgresql tricks and gotchas", and the resultant thread, and do a search for mysql for perspectives. there are fancier ways of doing this, but this is one of the canonical approaches.