#!/usr/bin/perl
use strict;
use LWP::Simple;
my $head = '
';
my $tail = '';
my $content = get("http://www.ktipp.ch/service/Warnlisten/telefonterror.php");
my $entry;
my @entries;
foreach my $line (split /\n/, $content) {
$line =~ s/\r//g;
if ( $line =~ $head ) {
$entry = $line;
} elsif ($entry) {
$entry .= $line;
if ($line =~ $tail) {
$entry =~ s:
: :g;
$entry =~ s:\xA0::g;
my ($nr, $com) = $entry =~ /^\s*${head}\s*(.*?)<\/span>\s*(.*?)<\/li>/i;
$com =~ s:<[^>]*>::g;
$com =~ s/^\s+//; $com =~ s/\s+$//;
push @entries, [ $nr, $com ];
undef $entry;
}
}
}
foreach my $a (@entries) {
printf ("%-40s | %s\n", @$a);
}