On a note unrelated to the redirection of the output, is there any reason why you want to be using $$ as a parameter to this sub? $$ is global as the process id and you can access it from anywhere within the script. If you really want to be passing the pid of some other process, use a variable to indicate that, rather than changing $$.
I think you are confusing the first occurance of '$$' and the second, in the code above. The first one is a functionprototype, the second is the global var you mention. Prototyping isn't common in perl, so it looks a little funny, but the two '$$'s have nothing to do with one another.