deriwana has asked for the wisdom of the Perl Monks concerning the following question:
Could you guys take a peek at my code?
I would appreciate any suggestions on bugs, bad syntax,etc.
As you can tell, it's just a script that retrieves records from a flat-file database.
THANKS
I would appreciate any suggestions on bugs, bad syntax,etc.
As you can tell, it's just a script that retrieves records from a flat-file database.
THANKS
#!usr/local/bin/perl -w use CGI; $query =new CGI; $guest_file = "guests.txt"; &print_page_start; if ($query->param()) { $search_name = $query->param('search_name'); eval { open (GUESTS, "< $guest_file") or die "Can't open $guest_file: $!"; while (<GUESTS>) { chomp; ($name, $email, $comments) = split /::/; if ($name =~ /$search_name/i { print "$name<BR>\n$email<BR>\n$comments<BR>\n<HR>\n"; } } } } else { print "<FORM>\n"; print "<INPUT TYPE=\"text\" NAME=\"search_name\"><BR>\n"; print "<INPUT TYPE=\"submit\">\n"; print "</FORM>\n"; } chomp $@; if ($@) { print "ERROR: $@<BR>\n"; } &print_page_end; sub print_page_start { print $query->header; print "<HTML>\n<HEAD>\n<TITLE>Search for Records</TITLE>\n"; print "</HEAD>\n<BODY>\n"; print "<H1>Search for Records</H1>\n; } sub print_page_end { print "</BODY>\n</HTML>\n"; }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: C any bugs?
by jeroenes (Priest) on Jun 18, 2001 at 21:19 UTC | |
Re: C any bugs?
by buckaduck (Chaplain) on Jun 19, 2001 at 00:29 UTC | |
Re: C any bugs?
by murphya (Sexton) on Jun 18, 2001 at 22:04 UTC | |
by tilly (Archbishop) on Jun 18, 2001 at 23:15 UTC | |
Re: C any bugs?
by Anonymous Monk on Jun 18, 2001 at 21:48 UTC | |
by dimmesdale (Friar) on Jun 18, 2001 at 21:53 UTC |
Back to
Seekers of Perl Wisdom