in reply to Re: Re: Match function not providing results
in thread Match function not providing results

I guess you mean /[ad]/. If we look at what I wrote above, /[ad]/ will match any string that contains either an a or a d, which is not yet exactly what you want.

My advice is that you don't need regular expressions at all, since the set of correct answers can be constructed as a string, for example ad, and the set of given answers can be concatenated to a string as well. Checking whether an answer is correct in total is then just a matter of comparing two strings for equality. But first, we need to take a look at the CGI documentation for checkboxes. The example there tells us how to get the checked boxes, so now all we got to do is to concatenate these into one string and compare them against the correct answer :

my @selected_answers = param('s1'); my $correct_answer = join( "", @selected_answers ); if ($given_answer ne $correct_answer) { print "Bleh ! You lose !" } else { print "Yay ! Correct !" }

A small side note - you are not using the strict module. This is very bad and will hide many programming errors from your eyes. So please use strict; !

perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web