Using my incredible magic powers, I shall guess that you are uploading a perl script with line endings in windows format, to a linux type machine, and not converting the line endings. Thus your shebang actually looks like
and perl^M doesn't exist on the machine so it doesn't run. This of course has nothing to do with apache or perl, but when you add -w infront of the ^M, the kernel can find the appropiate interpreter and perl ignores the ^M.