in reply to problem with shebang
It's hard to tell with the formatting, but is it possible that your shebang isn't the first line of the file? If it's on the second line, it's just a comment, and your program is being fed to some other interpreter than Perl.