Second, understand that you are not dealing with a database, but a flat file. Big difference. If you are stuck with a flat file, sobeit but it is not a database.
Try opening the file for read, put it into an array, loop through this array, push each record onto a new array unless a match is found and then print the contents of the second array into the file:
#!/usr/bin/perl -Tw use CGI qw(:standard); use strict; # delete a specific line if (param('action') eq 'delete' { open(FILE,"$file"); while(<FILE>) { chomp; ($company_name,$street,$city_st_zip,$phone,$fax,$website,$email,$c +ategory,$storefront,$logo,$alpha,$first_name)=split(/\|/); if (param($company_name) eq $company_name || ....) # match { push(@file,$_); } } close(FILE); open(FILE,>$file); { foreach (@file) { print FILE $_ . "\n"; } } }
I am not totally sure this will solve your problem but it will make your code easier to read and therefore easier to debug.
In reply to Re: Wierd DB Question
by jonjacobmoon
in thread Wierd DB Question
by lisaw
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |