[Chicago-talk] advanceing through a file w/o using an array

Dooley, Michael Dooley.Michael at con-way.com
Thu Nov 6 09:54:06 CST 2003


ok, I haven't looked at perl in well pretty much forever.

#! /usr/bin/perl -w

$FILE='path_to_mail_file';

open (MAILFILE, "$FILE") || die "Can not read file ($!)";

while (<MAILFILE>) {
        chomp;
        if ($_ =~ /^From / || /^Subject: /) {
                print "$_\n";
        }
}


ok this is all I have so far. which is pretty easy in the first place.
the part I am working on is getting the body of the email and displaying
that.

the body comes after "Message-Id: " and ends on the line befor "^From ".

Is there a variable I can use to print the line after a match untill another
match is found?

kinda like 
if ($_ =~ /Message-Id: /) {
                print the next line until $_= "^From "
        }



More information about the Chicago-talk mailing list