I'm new to perl. I was given a script to modify that should append the output below (as a result of a cmd run) to an existing log file and also save it to a variable/array to then print out in an email. I'm not sure how to print each line (in the array) from within the *here* doc. Please advise. Thanks!

OUTPUT:
Multiutil: The MASTER_UPDATE_PACKET packet sent from BLFST_REPLICA at 2006-06-22 22:45:07 for 'MASTR' cannot be replayed: This replica has not replayed epoch 8757 from replica BLFST_REPLICA, it has only replayed through 8756.
Multiutil: Packet E:\MultiSite_Packets\ClearQuest\var\shipping\ms_ship\incoming\sync_BLFST_REPLICA_22-June-06_23-45-07.xml not processed...

CODE:
$hostname = `hostname`; use Net::SMTP; @Output = ""; @OutputDetails = ""; $Log_File = "E:\\Backups\\LOGs\\Sync_Import.log"; open (STDOUT,">>$Log_File"); open (Output,"multiutil <cmd>|"); while(<Output>) { $TheLine = $_; chomp($TheLine); #Get rid of line break push (@OutputDetails, $TheLine); } Mail_Body; Mail_Msg; sub Mail_Body{ $body0 = "This message sent by the Import Process"; $body1 = "\n $TheLine\n"; <==== REPLACE w/@OutputDetails } sub Mail_Msg{ $smtp = Net::SMTP->new( "mail.company.com" ); $smtp->mail( "ALIAS\@company.com" )"; $smtp->to('ALIAS\@company.com'); $smtp->data(); $smtp->datasend("Subject:Job Failure\n"); $smtp->datasend(<<EOF_MAIL $body0 $body1 <==== THIS SHOULD BE EVERY LINE IN @OutputDetails EOF_MAIL ); $smtp->datasend(); $smtp->quit(); }

In reply to Printing an array in a Here Doc by tmtech1

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.