in reply to Print Question

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.

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

    (Or you could use an array of hashes, and have the indeces be the same as what you're using now.)


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

      wouldn't an array of hashes be a bit of a waste of memory in this case?

      cheers,

      J

        Less so then a hash of hashes.


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