You are 100% correct! That said I would recommend the following for your presentation; go ahead and show the Perl code, explain your criticisms and then demonstrate a workable version either in Perl or (my choice) Mathematica. Perhaps a headline such as "When go answers go bad" or some such.
--hsm
"Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Comment on Re^3: The Exponentiation of (not-so) Large Primes