> And IMHO there is no unavoidable situation in Perl where it matters if any blanks were unwillingly inserted.

Not always, POD often demands completely empty lines !

> displaying underscores for whitespaces is very confusing.

I know what you mean, but it's not an underscore it's underlined! 8)

You can either switch it off  (setq cperl-invalid-face nil)

Or you are free to configure a new face¹ other than "underlined" to be used.

I expanded this config which I found in emacswiki:cperl-mode to default to 98% grey background. It's in my .emacs just after loading cperl-mode.

(defface cperl-my-trailing-spaces-face '((((class color)) ;; define your tastes (background, foreground) ( :background "grey98" ; :underline "grey" ) )) "My face for trailing spaces in cperl mode" :group 'cperl-mode) ; Here is the most important part. It says t +o add ; this face to the customizable group cperl- +mode ;; now you can "bind" this face to cperl-invalid-face (set-default 'cperl-invalid-face 'cperl-my-trailing-spaces-face)

M-x customize-face cperl-my-trailing-spaces-face will show you a "GUI" to change these defaults, test and save all these face settings. Or you can click thru the menus to the customization-group "cperl-mode"

HTH!

Cheers Rolf

FOOTNOTES:

¹) a face is roughly the correspondant of a CSS-class in emacs speak


In reply to [emacs] Trailing whitespace by LanX
in thread [Golfing] Uncommenting a block by LanX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.