Help for this page

Select Code to Download


  1. or download this
    my %validate = (
            int  => sub { my($v)=@_; $v=~/^[0-9]+$/; },
            date => sub { my($v)=@_; $v=~/^[12]\d\d\d\-[01]?\d\-[0123]?\d/
    +; },
    ...
                    print "\tIs '$type'\n" if ($validate{$type}($value));
            }
    }
    
  2. or download this
    $validate{$new_type}
         = eval "sub { my(\$v)=\@_; \$v=~$regex; }";