This is where your editor can help. Emacs' cperl-mode can display trailing whitespace. For example:
The underscore after EOT indicates a trailing space which can help a lot in this case.print <<"EOT"; This is a piece of text. EOT_
All that is gold does not glitter...