Hi all, I get the error: "Undefined subroutine &Main::BadData called at line 42" when executing the following '.cgi' script, with nothing entered in all of the text fields. I'm unfamiliar with this error.
Could someone give me an explaination behind this error? Here's the code: use strict; use warnings; use CGI qw(:standard); use CGI::Carp qw(fatalsToBrowser); print header(), start_html("Which Triangle Is It?"); print p("This page tells you what type of triangle you've entered."), br(), "A triangle with each side being equal is equilateral.", br(), "A triangle with two sides being equal is an isosceles triangle.", br(), "A right triangle is one where the square of one side is equal to", br(), "the sum of the squares of the other two sides.", br(); print br(); print '<FORM method="post" action="pg250ex7.7_whichTriangle.pl">'; print '<TABLE bgcolor="lightblue">'; print Tr( td("Enter length of first side: "), td('<INPUT type="text" name="side1">') ); print Tr( td("Enter length of second side: "), td('<INPUT type="text" name="side2">') ); print Tr( td("Enter length of third side: "), td('<INPUT type="text" name="side3">') ); print Tr( td('<INPUT type="reset" value="Clear">'), td('<INPUT type="submit" value="Submit">') ); print "</TABLE></FORM>"; my $firstSide = param("side1"); my $secondSide = param("side2"); my $thirdSide = param("side3"); if ($firstSide =~ /^(\d+)$/) { $firstSide = $1; if ($secondSide =~ /^(\d+)$/) { $secondSide = $1; if ($thirdSide =~ /^(\d+)$/) { $thirdSide = $1; if ($firstSide == $secondSide && $firstSide == $thirdSide) { print p("That's an equilateral triangle!\n"); } elsif ($firstSide == $secondSide || $firstSide == $thirdSide || $secondSide == $thirdSide) { print p("That's an Isosceles triangle!\n"); } } } } else { BadData(); } sub BadInput { print p("Please, enter numbers only!"); die "Click the \"Clear\" button and try again.\n"; } print end_html(); TIA, Ron Smith [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>