use CGI::Ajax; use CGI; use strict; my $q = new CGI; sub perlreg { my($string, $regexp)=@_; my $i=0; my @matches = $string =~ $regexp; my $rv = ''; if(!@matches){return "no matches";} if($regexp !~ /\(/){ return "true";} foreach my $match (@matches){ $rv.= '$'.++$i. "=$match
"; } return $rv; }; my $pjx = CGI::Ajax->new('regexper'=>\&perlreg); print $pjx->build_html( $q ,\&ShowForm ); sub ShowForm{ my $rv = "\n\nAjax Regular Expression Example\n"; $rv .= "\n\n\n"; $rv .= < =~ / /
result goes here:
EOT return $rv; }