in reply to Using a subroutine as a module

Wow, all great answers and a big help. I can hardly wait to get started. Thanks responsive monks!

Update:
It worked as shown below. Good stuff and sorely missing from the literature. Maybe this would make a good Q&A (now an unapproved question, under subroutines).
#!/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"; Validate::val_time($the_time); $the_time = $Validate::val; if ($the_time) { print "$the_time\n" } else { print "error\n" }
And the module:
package Validate; # use package to declare a module our $val; sub val_time { $val = shift; $val = ($val =~ /^(\d{2}):(\d{2}) (am|pm)$/) ? "$1:$2 $3" : 1; return $val; #worked with and without this line } 1;
Thanks!