This must be sensitive to the environment, because I don't get any errors running your example. This is on Knoppix 5.0 with Linux kernel 2.6.17, perl 5.8.8, vim 6.4.7, and Text::VimColor 0.11. Update: and thttpd 2.23beta1, rather than Apache.
One oddity in your example:
really should be
In your example, that only changes the \n in the print statement into a literal line feed. In a bigger test case variable substitution would remove all the variable names in the quoted script.