On Thursday, June 13, 2002, at 11:27 , tom poe wrote:
[..]
> 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;


back to RFC822 happy Kampfr's - specifically section 4.1
cf:http://www.faqs.org/rfcs/rfc822.html

remember that the maxim:

"    message     =  fields *( CRLF *text )       ; Everything after
                                                  ;  first null line
                                                  ;  is message body
"

hence you really want two loops as Michael Lamertz recommends

        last if /^\s*$/ while(<IN>) ; # just skip the header
        push @body, $_  while(<IN>) ; # push the body in one line at a time

or
        push @head, $_  while(<IN>) ; # push the header in one line at a time
        push @body, $_  while(<IN>) ; # push the body in one line at a time

HTH

        
        

ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to