It is most portable to rely on $/ or "\n". "\r" is incorrect in unix.
It is often helpful to bracket variables in interpolating quotes like so:
print ">${unixfrom}\n";
which allows a construction like "\>${unixfrom}foo\n" in concatenation.
It would be good to print a list of arguments instead of constructing a sequence of print statements.
{
local $, = "\n";
print '>' . $unixfrom,
$return_path[$j],
$received[$j],
$date[$j],
$from[$j],
$to[$j],
$subject[$j],
$message_id[$j],
$mimeversion[$j],
$content_type[$j],
$xstatus[$j],
$xkeywords[$j],
$xuid[$j];
}
That will save some unneeded churning around with interpolation. The print function stringifies its arguments by default, so interpolating quotes are unnecessary.
After Compline, Zaxo | [reply] [d/l] [select] |
print '>', $unixfrom, join("\n",
$return_path[$j],
$received[$j],
$date[$j],
$from[$j],
$to[$j],
$subject[$j],
$message_id[$j],
$mimeversion[$j],
$content_type[$j],
$xstatus[$j],
$xkeywords[$j],
$xuid[$j]);
. That is, to me, much more clear then using the semi-magical $,.
Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).
| [reply] [d/l] [select] |
Somewhat off topic, but whenever you have multiple arrays that describe the same thing, you should probably make it a hash of hashes instead. Something like this would be better and easier to deal with:
%messages = (1 => { unixfrom => "blah",
return_path => "foo@bar.com",
received => "blorg",
date => "another date",
from => "bar@foo.com",
to => "you@me.com",
subject => "Spam Me Senseless!",
message_id => 42,
mimeversion => "text/plain",
content_type => "text/plain",
xstatus => "foop",
xkeywords => "spam trash garbage",
xuid => 13
}
);
With a hash, the key represents the message and could either be any unique value, or possibly even the message_id (if it is unique). Printing it out is then just a matter of looping through the keys, retrieving the values, and printing them. | [reply] [d/l] [select] |
| [reply] |
| [reply] |