title: How can I extract the contents of a specific table from HTML source using Perl?
body: <p>I have to parse 5000 files - which look pretty identical.</p>
  
  <p>I like using <a href="http://search.cpan.org/perldoc/HTML%3a%3aTokeParser%3a%3aSimple" rel="nofollow">HTML::TokeParser::Simple</a> and <a href="http://search.cpan.org/perldoc/DBI" rel="nofollow">DBI</a> in order to do the parsing job and store the results.</p>
  
  <p>I have little experience with <code>HTML::TokeParser::Simple</code> but this task goes over
  my head. Note: i also have had a look at the ideas - that seems to be also an appropiate way. But at the moment i have issues to get the correspodending xpath-expressions: I tried to determine the corresponding xpath-expressions that needs to be filled in the Perl-programme.</p>
  
  <p>This is what I have right now:</p>
  
  <pre><code>use strict;
  
  use HTML::TreeBuilder::XPath;
  
  my $tree = HTML::TreeBuilder::XPath-&gt;new;
  
  #use real file name here
  open(my $fh, "&lt;", "file.html") or die $!;
  
  $tree-&gt;parse_file($fh);
  
  my ($name)       = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($type)       = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($adress)     = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($adress_two) = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($telephone)  = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($fax)    = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($internet)   = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($officer)    = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($employees)  = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($offices)    = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($worker)     = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($country)    = $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  my ($the_council)= $tree-&gt;findnodes(qq{/html/body/table/tr[1]/td[2]});
  
  
  print $name-&gt;as_text;
  print $type-&gt;as_text;
  print $adress-&gt;as_text;
  print $adress_two-&gt;as_text;
  print $telephone-&gt;as_text;
  print $fax-&gt;as_text;
  print $internet-&gt;as_text;
  print $officer-&gt;as_text;
  print $employees-&gt;as_text;
  print $offices-&gt;as_text;
  print $worker-&gt;as_text;
  print $country-&gt;as_text;
  print $the_council-&gt;as_text;
  </code></pre>
  
  <p>is this all right ?  Note - i w ant to store this in a database.</p>
  
  <p>BTW: See one of the example sites: </p>
  
  <p><a href="http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/detail.php?id=04313488" rel="nofollow">http://www.kultusportal-bw.de/servlet/PB/menu/1188427/index.html?COMPLETEHREF=http://www.kultus-bw.de/did_abfrage/detail.php?id=04313488</a></p>
  
  <p>in the grey shadowed  block you see the wanted information: 17 lines that are wanted. Note - i have 5000 different HTML-files - that all are structured in the very same way!</p>
  
  <p>That means i would be happy to have a template that can be runned with HTML::TokeParser::Simple and DBI. </p>
  
  <p>Can i make use of the above mentioned code... or do i have to change it. </p>
  
  <p>Love to hear from you! That would be great!!</p>