Next | Trivial Utilities | 155 |
foreach $file (@ARGV) { ... $/ = ''; $header = <IN>;
This is a nice idiom for reading an email header
Normally, I would use local($/)
In a program this size, it doesn't matter
$header =~ s/^Received:\s+.*\n(\s+.*\n)*//mg;
This depends on a rather important feature of regexes:
The . symbol does not match a newline
print OUT $header;
$/ = "\n"; while (<IN>) { print OUT; } }
Next | Menu | Copyright © 2012 M. J. Dominus |