I have a listing of multiple flat-file databases all stored under one directory (such as: $directory/file1.list.cgi $directory/filemore.list.cgi etc.)

The directory stores different information for an automatic mailing list, in the format of: name|email address another name|another email address

I want to be able to run one script that opens up all of these files and then deletes a specific line that matches an inputted email address, but leaves the other lines untouched UNLESS they match the pattern you submit through the form.

Can anyone point me in the right direction? I just can't quite get it down right...

Open the data file(s) and store them into arrays. After reading all of the data bases close all the opened files. Then use a foreach condition on the arrays and use the next; function to get rid of the line you don't want.

That was a confusing description but it's only meant to describe the following code.

open(file1, "</path/file.db") @all=<file1>; close(file1)

Repeat this for as many data files you need to remove the line from.

open(file2, "</path/file2.db") @all2=<file2>; close(file2)

I'll stop at two but if you have more then continue.

Now you need to remove the lines with the information inputed into a form.

open the same data base that the information stored in @all came from.

open(Write, ">/path/file.db"); foreach $line (@all) { @fields=split(/\|/, $line); # I suppose your using a pipe to separate your fields if ($field[0] eq "$form{'address'}") # $field[0] is the field that contains the data you are looking to get rid of. { next; } # print the filtered data back to the file it came from in the same order print Write "$field[0]|$field[1]|so on and so on"; }