Perl math program

I have this math program on Perl and when I run it one of the math problems that comes up is 0/0 and perl makes the answer 4. How can I program perl to not include numbers /0?
What I have for the division portion is:

$solution = $num1 * $num2;
($solution, $num1) = ($num1, $solution);
$question = "$num1 / $num2 = ";
$question = "$num1 / $num2 = " unless $num2 == 0;

Removed.