My first perl-parser runs very well - (thanks to the support of some friends here).
BTW: Well i am very very glad to be here - this is a great place and i have a nice learning curve...This forums give me a great asset of
learning!!
What is aimed: i am parsing site with a small table - see the site:
http://www.schulministerium.nrw.de/BP/S ... pDO=142359
Note: This page [and many others that are simmilar] is/are stored locally in the same folder as file t.html
Now i want to store the data in a MySQL-DB: i am figuring out how to do this:
here the code:
Code: Select all
#!/usr/bin/perl
use strict; use warnings;
use HTML::TableExtract;
use YAML;
my $te = HTML::TableExtract->new(
attribs => { class => 'bp_ergebnis_tab_info' },
);
$te->parse_file('t.html');
foreach my $table ( $te->tables ) {
foreach my $row ($table->rows) {
my @values = grep {defined} @$row;
print " ", join(',', @values), "\n";
}
}
Code: Select all
Schulnummer, 143960
Amtliche Bezeichnung,Franziskusschule Kath. Hauptschule Ahaus - Sekundarstufe I
Strasse, Hof zum Ahaus 6
Plz und Ort, 48683 Ahaus
Telefon, 02561 4291990
Fax, 02561 42919920
E-Mail-Adresse, 3960@schule.nrw.de
Greetings lin