writing math testing program

Can anyone create a program that
would test the math skills of the user. Assume that it would test integer addition, The program should ask the question,collect the integer response, evaluate and notify the user if their answer was correct or incorrect. I would assume integers in the range {1..100}.

either shell scripts or perl should be OK
Thanks a bunch

Are you asking for someone to write you the program or just if it is possible? It is possible.

Can I do it this way?

#!/usr/bin/perl

print "\nplease enter first number, second number, enter M for multiplication, A for addition,S for substraction, and finally your answer";

chomp ( $1=<STDIN>);
chomp ( $2=<STDIN>);
chomp ( $3=<STDIN>);
chomp ( $4=<STDIN>);

if $3 ~/M/i && ($4 == $1 * $2)
{ print " your answer is right";}

elsif
if $3 ~/A/i && ($4 == $1 + $2)
{ print " your answer is right";}

elsif

if $3 ~/s/i && ($4 == $1 - $2)
{ print " your answer is right";}

The code you posted has a few syntax errors. Don't use numbered variables ($1, $2 etc) those are reserved by perl for pattern memory and are read-only. Use the warnings pragma:

use warnings;

You have the general idea although you should also validate the user input (like make sure the user has only entered integers) and correct the synax errors. Its also good to add a fall-through condition to the end of an if/elsif chain:

if () {
}
elsif () {
}
elsif () {
}
else {
   fall-through condition
}

Kevin, can you reread the question again, I need to ask user question "One time" only, also should I use some function like rand ()?

collect the integer response, evaluate and notify the user if their answer was correct or incorrect. I would assume integers in the range {1..100}

Use rand for what? I thought the user was going to input the numbers and the operation they want to perform ( x + - / etc).

If you want the user to input all the data at one time:

print  "Enter two numbers between 1 and 100 and one of the following math operations to perform [ + - x /] and the answer. Example: 3 X 17 = 51. ";

Then you check that there are two numbers, a math operator and the answer.

chomp (my $input = <STDIN>);
my ($int1, $operator, $int2, undef, $answer)   = split(/\s+/,$input);
here you validate the input and 
perform the math and check the answer