Hi Anthony, almost certainly a line endings problem. The script needs "unix" line endings, and I'll bet it's currently got "mac" line endings.
Check the settings in your text editor. Something like perl -pi -e 'tr/\015/\012/' macperl.pl should sort out the problem if my guess is right. Cheers, Paul