As far as I remember perl you can reduce this code to:
$text = "";
while (<>) {
chop;
$text .= $_;
}
$text =~ s/<[^>]*>//g;
print $text;
On 5 Oct 1997, Jari Aalto wrote:
| Fri 97-10-03 Kimmo Jaskari <kimmo(_at_)alcom(_dot_)aland(_dot_)fi>
list.procmail
[Html to text converter]
Here is one elegant perl code that does the formatting. I have
kept it around long time. I have no ide if the http is valid, but...
# ftp://ftp.sunet.se/pub/unix/utilities/glimpse/html2txt
#
# converts html files into ascii by just stripping anything between
# < and >
# written 4/21/96 by Michael Smith for WebGlimpse
$carry=0;
while(<>){
$line = $_;
if($carry==1){
# remove all until the first >
next if($line!~s/[^>]*>//);
# if we didn't do next, it succeeded -- reset carry
$carry=0;
}
while($line=~s/<[^>]*>//g){};
if($line=~s/<.*$//){
$carry=1;
}
print $line;
}
---
Stephan Witoszynskyj <swito(_at_)fsph2(_dot_)htu(_dot_)tuwien(_dot_)ac(_dot_)at>