in reply to Perl module to show whitespaces?

A simple way would be:
s/\s/_/g;
No need for a module for that. You can of course be more fancy and show newlines as \n or ^J, tabs as \t or ^I, etc. All trivial to do with a regexp.