http://www.perlmonks.org?node_id=628141


in reply to OT: updating database question

With the effort you have gone to to normalise your data, I dont think that the laziness of rewriting your data each time is good laziness. It could indeed be dangerous - because a user could accidentally change the data on the form and submit an error. By rearranging your form so that people input changes only, perhaps by using a dropdown to select the old name and new qualification, or a text box to enter a new name and a new qualification. If you are using SQL then you could update it will an UPDATE query something like  UPDATE person_qual SET qual = (SELECT id FROM qual_id WHERE qual = 'MA') WHERE person IN (SELECT id FROM name_id WHERE name = 'Alice'); If you are manually implementing your own database with text files, you will probably have to rewrite the file each time, though you could perhaps just append a line each time - thus allowing you to undo changes easily.