title: Printing all HTML Tables with certain string for multiple files (perl)
body: <p>I am trying to print all the HTML tables containing the string "kcat" for each xml file in a directory but I am having some trouble. Note that each file in the directory (named kcat_tables) has at least one HTML table with kcat in it. I am running this program on an ubuntu virtual machine. Here is my code:</p>
  
  <pre><code>#!/usr/bin/perl
  use warnings;
  use strict;
  use File::Slurp;
  use Path::Iterator::Rule;
  use HTML::TableExtract;
  use utf8::all;
  my @papers_dir_path = qw(/home/bob/kinase/kcat_tables);
  
  my $rule = Path::Iterator::Rule-&gt;new;
  $rule-&gt;name("*.nxml");
  $rule-&gt;skip_dirs(".");
  
  my $xml;
  my $it = $rule-&gt;iter(@papers_dir_path);
  
  while ( my $file = $it-&gt;() ) {
      $xml = read_file($file);
      my $te = HTML::TableExtract-&gt;new();
      $te-&gt;parse($xml);
      foreach my $ts ( $te-&gt;tables ) {
          if ( $ts =~ /kcat/i ) {
              print "Table (", join( ',', $ts-&gt;coords ), "):\n";
              foreach my $row ( $ts-&gt;rows ) {
                  print join( ',', @$row ), "\n";
              }
          }
      }
  }
  </code></pre>
  
  <p>Any ideas on how I should fix this? Thanks in advance! Also, I am fairly new to the PERL language so a simple, comprehensible answer would be very much appreciated.</p>