in reply to Print Question

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

Replies are listed 'Best First'.
Re: Re: Print Question
by theorbtwo (Prior) on May 18, 2003 at 04:00 UTC

    I'd write this as

    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).