perl script

with much help and thanks to Optimus_P, i was able to write a perl script to read a user mailbox, then dump the contents formatted as i see fit. one problem though, i need to have the latest message displayed first, instead of last. the way it is now, the latest email recieved is appended to the bottom of the mbox file, so, this is the same way that my perl script outputs the file. i want my perlscript to output the latest message first, and the oldest message last. i need to have the perl script read the mbox file backwards. line by line backwards is no good, as the body of the message will be output backwords,
ie:
like this.
in reverse order
would get output
every line

thats no good for me :smiley: .
my script follows

#!/usr/bin/perl

use Mail::Box::Mbox;
# use Mail::Message::Field;

my $folder = Mail::Box::Mbox->new( folder => '/var/mail/main' );
#my $folder = Mail::Box::Mbox->new( folder => '/home/main/mbox' );
my $head = Mail::Message::Head->new;

foreach my $msg ( $folder->messages() )
{
        print "<br>";
#       print "<b>", $msg->replyPrelude($head->get('sender')),"</b>"; # there was no space after 'From'
        print "<b>Subject:</b><b>",$msg->subject(),"</b><br> \n";
        print "<br>\n",$msg->body(),"\n";
        print "<br>";
}

Try

foreach my $msg ( reverse ($folder->messages()) )

wow that was it. you got it. thanks alot!!