"Randy W. Sims" <[EMAIL PROTECTED]> writes:
> Harry Putnam wrote:
>> I'm writing a home boy mail/news search tool and wondered if there is
>> a cononical way to handle folded or indented header lines.
>
> There are modules to help read mail headers, but if you want something
> simple you can modify the following example:
>
> #!/usr/bin/perl
>
> use strict;
> use warnings;
>
> open(MAIL, 'mail.msg') or die $!;
>
> my $line;
> LINE:
> while (<MAIL>) {
> chomp;
> if (1../^$/) {
> unless (/^\s/) {
> print "$line\n";
> $line = $_;
> } else {
> s/^\s+/ /;
> $line .= $_;
> next LINE;
> }
> }
> }
>
>
> You can perform your matches at the point where I placed the print
> statement; at that point a complete line is assembled.
Nice, that fixes the folds alright. But if I might pester you a bit
further, I don't recognize the syntax in at least two parts.
I see what the result is but can you explain in english what these
lines do:
if (1../^$/)
and
$line .= $_;
I'm guessing the first is something similar to:
if(!/^$/)
But have no guess on the second one.
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>