#!/usr/bin/perl print "Content-type: text/plain\n\n"; use strict; use CGI::Carp qw(fatalsToBrowser); use validate; my $the_time = "12:23 pm"; &val_time( $the_time ); $the_time = $val; if ($the_time) { print "$the_time\n" } else { print "error\n" } #### #!/usr/bin/perl our $val; sub val_time { $val = shift; $val = ($val =~ /^(\d{2}):(\d{2}) (am|pm)$/) ? "$1:$2 $3" : 1; }