Process form with regular expression: date
<html> <head> <title>form page</title> </head> <body> <p>here's my test form</p> <form method = "post" action = "/your.pl"> <p>First name: <input name = "firstName" type = "text" size = "20"></p> <p>Last name: <input name = "lastName" type = "text" size = "20"></p> <p>Phone number: <input name = "phone" type = "text" size = "20"></p> <p>Date (MM/DD/YY): <input name = "date" type = "text" size = "20"></p> <p>Time (HH:MM:SS): <input name = "time" type = "text" size = "20"></p> <input type = "submit" value = "submit"> <input type = "reset" value = "reset"> </form> </body> </html> #your.pl #!/usr/bin/perl use strict; use warnings; use CGI ':standard'; my $firstName = param( "firstName" ); my $lastName = param( "lastName" ); my $phone = param( "phone" ); my $date = param( "date" ); my $time = param( "time" ); print header(); print start_html( -title => "form page" ); if ( $date =~ m#^(1[012]|0?[1-9])/([012]?\d|3[01])/(\d\d)$# ) { print "<p>The date is $1 / $2 / $3.</p>"; } print end_html();