atnonis has asked for the wisdom of the Perl Monks concerning the following question:
The problem is that the pattern matching don't work and i can't figure out what is wrong.sub duplicate_record { my $html_title = 'Duplicate records have been found!'; die("Cannot open file for matching\n") unless open (DBFILE, "dbfile +.pdb"); while (<DBFILE> and $found == 0) { #while not eof file and pattern +not matched ($found == 0) foreach $record (<DBFILE>) { #foreach line ($record) @pattern_check = split(/,/, $record); #spit line where you se +e comma (,) ($record) if ($name eq $pattern_check[0] and $surename eq $pattern_chec +k[1]) { #check if duplicate is available print $cgi-> start_html("$html_title"). $cgi-> h1('Duplicate records:'). $cgi-> p("$name $surename $phone already exists.\nGo ba +ck and fill something else than that!"). $cgi-> end_html; $found = 1; }#if }#foreach }#while close (DBFILE); if ($found == 0) { save_db(); }#if }# sub duplicate_record
edited: Mon Jan 20 17:39:02 2003 by jeffa - tightened up lhs (tabs to spaces, etc)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: cgi programming problem with perl
by Hofmator (Curate) on Jan 20, 2003 at 14:43 UTC | |
|
Re: cgi programming problem with perl
by fruiture (Curate) on Jan 20, 2003 at 14:56 UTC | |
|
Re: cgi programming problem with perl
by gjb (Vicar) on Jan 20, 2003 at 14:36 UTC | |
|
Re: cgi programming problem with perl
by rdfield (Priest) on Jan 20, 2003 at 14:50 UTC | |
|
Re: cgi programming problem with perl
by robartes (Priest) on Jan 20, 2003 at 14:57 UTC | |
|
Re: cgi programming problem with perl
by OM_Zen (Scribe) on Jan 20, 2003 at 16:42 UTC |