Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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

In reply to Re^2: Help sending with MIME::Lite by etcshadow
in thread Help sending with MIME::Lite by drock

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-24 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found