use strict; my $flag = '0'; ### I had to take a few of the extra blanks out of the next three search variables my $from = 'From: '; my $full_subject = 'Subject: '; my $date = 'Date: '; my @buffer = (); my @spamcop_email_array = ; open (TEXTOUT, ">junk.out") || die "Can't open 'junk.out'"; #loop and fill @buffer# foreach (@spamcop_email_array){ if(s/.*$from//){ ### changed [0] to [1] $buffer[1] = $_; $flag = 0; } if(s/.*$full_subject//){ ### changed [1] to [2] $buffer[2] = $_; $flag = 0; ### moved print from date if block to here print TEXTOUT @buffer; } if(s/.*$date//){ ### changed [2] to [0] $buffer[0] = $_; $flag = 0; } } close TEXTOUT; __DATA__ From MAILER-DAEMON Fri Jan 4 18:04:20 2002 Date: 04 Jan 2002 18:04:20 -0600 From: Mail System Internal Data Subject: DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA Message-ID: <1010189060@loopey.faraway.net> X-IMAP: 0910805650 0000003175 Status: RO This text is part of the internal format of your mail folder, and is not a real message. It is created automatically by the mail system software. If deleted, important folder data will be lost, and it will be re-created with the data reset to initial values. From root@loopey.faraway.net Sun Jun 20 10:37:57 1999 Received: from localhost (root@localhost) by loopey.faraway.net (8.8.8+Sun/8.8.8) with ESMTP id KAA05403; Sun, 20 Jun 1999 10:37:57 -0500 (CDT) Date: Sun, 20 Jun 1999 10:37:56 -0500 (CDT) From: Super-User To: , xxxx xxxxx Subject: Re: accounts for DISL (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Length: 1064 Status: RO X-Status: X-Keywords: X-UID: 263 joey, Looks like you may have sent Randy a note from root - here's her reply. I'll address the SAS issues. - Andy ---------- Forwarded message ---------- Date: Fri, 18 Jun 1999 09:01:04 -0500 From: rsch To: Super-User Subject: Re: accounts for DISL joey, If possible I would like to keep my account (rsch) to run SAS jobs for the faculty from time to time. Thanks, Randy From light@loopey.faraway.net Wed Mar 28 12:05:57 2001 Date: Wed, 28 Mar 2001 12:05:48 -0600 (Central Standard Time) From: xxxx xxxx To: xxx xxx xxx Subject: xxxxx account Sender: light@loopey.faraway.net MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Content-Length: 364 Status: RO X-Status: X-Keywords: X-UID: 1565 joey, when you get a chance, could you please do whatever is necessary to remove xxxx xxxxx xxxxx account? We will want to leave a forwarding record in place in the aliases file. #### 04 Jan 2002 18:04:20 -0600 Mail System Internal Data DON'T DELETE THIS MESSAGE -- FOLDER INTERNAL DATA Sun, 20 Jun 1999 10:37:56 -0500 (CDT) Super-User Re: accounts for DISL (fwd) Fri, 18 Jun 1999 09:01:04 -0500 rsch Re: accounts for DISL Wed, 28 Mar 2001 12:05:48 -0600 (Central Standard Time) xxxx xxxx xxxxx account