in reply to cgi programming problem with perl
sub duplicate_record { my ($name, $surename) = @_; my $is_duplicate = 0; my $html_title = 'Duplicate records have been found!'; open (DBFILE, "dbfile.pdb") or die("Cannot open file for matching: +$!"); local $_; while (<DBFILE>) { my @pattern_check = split(/,/, $_); #spit line where you see com +ma (,) ($record) if ($name eq $pattern_check[0] and $surename eq $pattern_check[1 +]) { #check if duplicate is available print $cgi->start_html($html_title). $cgi->h1('Duplicate records:'). $cgi->p("$name $surename $phone already exists.\nGo bac +k and fill something else than that!"). $cgi->end_html; $is_duplicate = 1; last; } } close (DBFILE); save_db() unless $is_duplicate; }
This should work better, let me make some remarks
-- Hofmator
|
|---|