Others have pointed out the correct syntax. I just wanted to comment on what $$#foo actually does. The weird number you're seeing is the process ID. Perl treats $$ as a variable name (see
perlvar) and the # introduces a comment just like it normally does. The fact that you didn't get a syntax error is a coincidence due to the fact that this print statement must have been at the end of a block.