Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re^2: Help sending with MIME::Lite

by etcshadow (Priest)
on Sep 17, 2004 at 20:38 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://391891]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (2)
As of 2024-04-19 01:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found