A
angel
hello i am a perl beginner and i need help. i dont know and have no
idea on how to make a program for this,
the program should ask a user 5 questions. it should read the answers
and shows the number of answers that were right.
example:
Please enter £ two times: ££
Correct!
Please enter $ four times: ***
Wrong!
*****
You got 4 correct answers.
I have already written a program for the 5 questions:
e.g.
print ("Please enter £ two times: ");
$pound = <STDIN>;
$correct = "Correct!";
if ($pound !~m/££/)
{
print("Wrong!\n");
}
else
{
print("$correct\n");
}
print("Please enter \$ four times: ");
$dollar = <STDIN>;
if($dollar !~m/^(\${4})$/)
(
print("Wrong!\n");
}
else
{
print("$correct\n");
}
my problem is i dont know on how it will read the answers and shows the
number of answers that were right. i would really appreciate any help.
thanks!
idea on how to make a program for this,
the program should ask a user 5 questions. it should read the answers
and shows the number of answers that were right.
example:
Please enter £ two times: ££
Correct!
Please enter $ four times: ***
Wrong!
*****
You got 4 correct answers.
I have already written a program for the 5 questions:
e.g.
print ("Please enter £ two times: ");
$pound = <STDIN>;
$correct = "Correct!";
if ($pound !~m/££/)
{
print("Wrong!\n");
}
else
{
print("$correct\n");
}
print("Please enter \$ four times: ");
$dollar = <STDIN>;
if($dollar !~m/^(\${4})$/)
(
print("Wrong!\n");
}
else
{
print("$correct\n");
}
my problem is i dont know on how it will read the answers and shows the
number of answers that were right. i would really appreciate any help.
thanks!