in reply to
Re^4: Annoying whitespace(s)...
in thread Annoying whitespace(s)...
I don't know anything myself about templating - another one of those programming tools I'll have to learn at some point - but I took a quick look at MIME::Lite just now, and it will make your script simpler, not more complicated.
mybox# perl -eshell -MCPAN
cpan> install MIME::Lite
...buncha installation messages...
mybox> perldoc MIME::Lite
Very cool stuff, and pretty easy to use. With Perl, if you can find a module on CPAN that does something for you, it's often best to install and learn that module, rather than code it yourself. Since you appear to have a C background, think of modules as installing a bunch of .h files with some easy-to-use functions.