code:
#!/usr/bin/perl
$www = "/home/driscoll/public_html";
$bin = "/home/driscoll/bin";
chdir($bin);
system "wget -q -O tor.html http://www.tor.com/schedule.html";
open(TOR,"$bin/tor.html");
$OF="$www/pub.html";
open(OF,">$OF");
@ltime = localtime(time);
$ltime[4]++;
$ltime[5] += 1900;
print(OF "<h2>Last Updated $ltime[4] / $ltime[3] / $ltime[5]</h2>\n");
$line = '';
$lflag = 0;
while (!eof(TOR)){
$tmp = <TOR>;
chomp $tmp;
if( $tmp =~ m/<P>/ ){
if( $line =~ m/<B>\w* 20\d\d<\/B>/ ){
$last = $line;
$last =~ s/<P><B>(.*)<\/B>/$1/;
$lflag = 0;
} elsif( $line =~ m/(Card|Goodkind|Jordan|Carey|Brin)/ ){
if( $lflag == 0 ){
print(OF "<H3>$last</H3>\n");
$lflag = 1;
}
$type = $line;
$type =~ s/.*(<EM>.*<\/EM>).*/$1/;
print(OF "$type\n");
print(OF "<UL>\n");
@list = split("<BR>",$line);
foreach $ent(@list){
chomp $ent;
if($ent =~ m/(Card|Goodkind|Jordan|Carey|Brin)/ ){
print(OF "<LI>$ent\n");
}
}
print(OF "</UL>\n");
}
$line = $tmp;
}else{
$line = $line.$tmp;
}
}
close(OF);
code:
#!/usr/bin/perl
$www = "/home/driscoll/public_html";
$bin = "/home/driscoll/bin";
chdir($bin);
system "wget -q -O tor.html http://www.tor.com/schedule.html";
open(TOR,"$bin/tor.html");
$OF="$www/pub.html";
open(OF,">$OF");
@ltime = localtime(time);
$ltime[4]++;
$ltime[5] += 1900;
print(OF "<h2>Last Updated $ltime[4] / $ltime[3] / $ltime[5]</h2>\n");
$lflag = 0;
$tflag = 0;
while ($line=<TOR>){
chomp $line;
$line =~ s/\&/\&/g;
if( $line =~ m/<B>\w* 20\d\d<\/B>/i ){
$last = $line;
$last =~ s/.*<B>(.*)<\/B>.*/$1/i;
$lflag = 0;
}elsif( $line =~ m/<em>/i ){
$type = $line;
$type =~ s/.*(<em>.*<\/em>).*/$1/i;
if( $tflag == 1 ){
print(OF "</UL>\n");
$tflag = 0;
}
}elsif( $line =~ m/(Card|Goodkind|Jordan|Carey|Brin)/i ){
if( $lflag == 0 ){
print(OF "<H3>$last</H3>\n");
$lflag = 1;
}
if( $tflag == 0 ){
print(OF "$type\n");
print(OF "<UL>\n");
$tflag = 1;
}
$line =~ s/(.*)<.*/$1/;
print(OF "<LI>$line\n");
}
}
close(OF);