in reply to Re^6: Perl Script in Windows Works, but not in Unix
in thread Perl Script in Windows Works, but not in Unix

You shouldn't have \r anywhere in a text file on Linux or Unix. Try dos2unix or, failing that, use:

perl -i~ -pe 'tr/\r//d; print' filename
to get rid of stray carriage returns.