in reply to Subroutine Behaviour

@_ is an array, and trying to see if it's equal to something tests the size of the array, not the contents. You should put something like

$num = shift;

at the beginning of the subroutine, and then say things like

if ($num == 0){

That way you're testing the actual contents of the array. (Also note that the $num inside the subroutine is not the same variable as the $num outside the subroutine; although in this case they will always have the same value.)

TheEnigma