http://www.perlmonks.org?node_id=391891


in reply to Re: Help sending with MIME::Lite
in thread Help sending with MIME::Lite

Questions to ask:
1. Is there a command for reading a file into a string variable?
Well, there's File::Slurp, which is almost too simple to be a module... it's as easy as:
my $contents = do { local (@ARGV,$/) = ($filename); <> };
or other, less obfuscated ways, which all involve locally undefing the input record separator $/.

2. Is there a way to output an entire array without having to join first, as I'm doing above?
Not really... if you want to slap an array of strings together into one long string, that's what join is for. I mean, you could have a loop which concatenates the values together, but join is simpler and (I'm guessing) faster. Of course, as mentioned above, by setting $/ to undef, you won't divide the text up in the first place, so it wouldn't matter.
------------ :Wq Not an editor command: Wq