SOLUTION
--------

This script essentially decodes the string $mystery.
While the string is not null, &searchforclue gets the first character off the string,
gets its ASCII value and subtracts 65.  This result is stored in $hint and represents the number of character pairs that the script will look at.

&examinehint sets $bighint to 2.  All the trigonomety is math identity fluff that evaluates to 1.  In specific sin(theta)*sin(theta)+cos(theta)*cos(theta)=1.  A couple x**0=1 type things thrown in for the fun of it, and some strings to evaluate to 0.

&hypothesize does the dirty work.  It loops $hint number of times, each time using a pair of characters, starting with the first two. The bitwise exclusive or of the ASCII values of these two characters is taken.  $bighint is multiplied by the result.  The next time through the loop, charcters 2 and 3 are used, then 3 and 4, and so on.

&displayconclusion simply prints the character with the ASCII value of $bighint.

&keepthinking takes the characters just used off the front of $mystery.

What is essentially happening is that the ASCII values of the characters in the string
"THE PERL JoURNAL" are being calculated from their prime factorizations.  The xor operations between the letter pairs read these prime factors.  Through the first while loop, $bighint is twice what it should be.  The second while loop does the same thing as the first except it calls &tryagain instead of &displayconclusion.  &tryagain just divides $bighint by 2 before printing its ASCII character.

Then, the script, confused and angered beyond all words, or most words, gives up.