in reply to Perl and maths

If you use KDE and can live with a really (really) basic interface, you could try using kdialog (I assume there is something similar for Gnome).
$val = `kdialog --title "Question" --inputbox "What is $a x $b?"`; if ($val == $correct) { system("kdialog --msgbox 'Correct!'"); } else { system("kdialog --msgbox 'Wrong!'"); }

I've used it for a math quiz thingy which was fairly successful. :-)