Hi: I really appreciate the input on separating $header and $body from those
on the list so far. The suggested modules all seem too complicated to me, so
I continue to read Chapter One, over and over. In the meantime, I think I
have something close to what I want to accomplish, but it still prints out
the entire email, both $header and $body.
My file that I'm using has the first five lines as $header, followed by 2
blank lines. The rest of the lines are the email message. When I run the
script:
#! /usr/local/bin/perl -w
# Simple program to prepare an email message for entry into a database
# This program simply discards header information, and collects message
# body into an array. Once in the array it should print out just the
# message body.
use strict;
my $file = '../perlStuff/email.txt';
my @body;
open (IN, "<$file") or die "Can't open $file: !$\n";
while (<IN>) {
# Skip lines unless we have a blank line
next unless /^\s*?/;
# Put the data line in an array.
push @body, $_;
my $string = join "", @body;
print @body;
}
close IN;
----------------
it prints out all 20 lines. I had hoped it would ignore the first five
lines, and start entering the next 15 lines, beginning with the two blank
lines. So, any help appreciated.
Thanks,
Tom
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]