Reference

Mail::Folder::FastReader(3pm)

Mail::Folder::FastReader - A fast mailbox reader

  use Mail::Folder::FastReader qw( read_email reset_file );

  open MAILBOX,"saved-mail";
  reset_file(MAILBOX);
  while (1)
  {
    my ($status, $email, $line_number) = read_email();
    last unless $status

    print <<EOF;
EMAIL STARTING ON LINE $line_number:
$email
-------------------------------------
EOF
  }
  close MAILBOX;

This module provides a simple and fast way to read unix-style mailboxes. It basically searches for the next line that begins with "From ", but which doesn't follow a "----- Begin Included Message -----".
FUNCTIONS Read the next email from the filehandle, storing the email in $email and the line number in $line. The status is 1 if successful, and 0 if not. Reset the internal line counter and the reference to the filehandle. Call this before calling read_email(). David Coppit <[email protected]> grepmail, mail(1), printmail(1), Mail::Internet(3) Crocker, D. H., Standard for the Format of Arpa Internet Text Messages, RFC822.