When I try to run the following script in zsh, via the command /bin/zsh ~/.set_color_scheme.sh I get the following error:
command not found: ^M
The script has u+x permissions and it used to work on another machine that also had zsh. Any clues why? 
Note: This question is related to this other question (where I am trying to adapt the script for tcsh)
#!/bin/zsh
# Contents of set_color_scheme.sh
export LS_COLORS=$( \
( grep '\w' | grep -v '^#' | sed 's/#.\+//' | perl -lane 'printf "%s=%s:", shift @F, join ";", @F;' ) <<< "
# HUMAN_FORMATTED_DATA
# list one per line
# these are basic filesystem items
no 00          # normal
fi 00          # file
di 01 34       # directory
ln 00 36       # link
pi 40 33       # pipe
so 00 35       #
bd 40 33 01
cd 40 33 01
or 01 05 37 41
mi 01 05 37 41
ex 00 91       # executable
ow 01 34       # other writables
*.cmd 00 32
*.exe 00 32
# archive, compressed things etc
*.gz  00 90
*.bz2 00 90
*.bz  00 90
*.tz  00 90
*.rpm 00 90
*.rar 00 90
*.zip 00 90
*.iso 00 90
*.cpio 00 31
# perl & CODE
*.c      33
*.h      33
*.sh     33
*.t      33
*.pm     33
*.pl     33
*.cgi    33
*.pod    33
*.PL     33
*.js     33
*.php    33
#*.xs
# strikethrough
*.off 00 9
*.bak 00 9
*.old 00 9
# documents misc, html webstuff
# really TEXT
*.htm    94
*.html   94
*.txt    94
*.text   94
*.css    94
# MOVIE
*.avi    96
*.wmv    96
*.mpeg   96
*.mpg    96
*.mov    96
*.AVI    96
*.WMV    96
*.mkv    96
# images & pdf
*.jpg    96
*.jpeg   96
*.png    96
*.xcf    96
*.JPG    96
*.gif    96
*.svg    96
*.eps 00 96
*.pdf 00 96
*.PDF 00 96
*.ps  00 96
*.ai  00 91 # adobe ill
*.doc 00 91 # msword 
# data, such as .db, .csv
*.csv    95
*.dsv    95
*.db     95
*.sql    95
*.meta   95
# CONFS
*.xml    95
*.yaml   95
*.yml    95
*.conf   95
# [a-z0-9]*rc
")

