Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Help sending with MIME::Lite

by etcshadow (Priest)
on Sep 17, 2004 at 20:38 UTC ( #391891=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2019-09-18 03:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The room is dark, and your next move is ...












    Results (221 votes). Check out past polls.

    Notices?