The previous print <<\EOF; doesn't have that problem. cperl-mode gets both correct. emacs-version "24.5.1"