http://www.perlmonks.org?node_id=89359

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
#!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"; }