A few ways to remove dos-formatted linebreaks (^M) from your code.
^M
^v
^m
:%s/^v^m//g
perl -pi -e "s:^v^m::g" <filenames>