Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

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?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2023-09-28 17:03 GMT
Find Nodes?
    Voting Booth?

    No recent polls found