my $exp2 = $Opt{exp2}; $exp2 and $exp2 = "[^>]*$exp2";
my $exp3 = $Opt{exp3}; $exp3 and $exp3 = "[^>]*$exp3";
-for my $table ($html =~ m,<${T1}${exp1}[^>]*>(.*?)<\s*/\s*${T1}\s*>,gi) {
+for my $table ($html =~ m,<${T1}${exp1}[^>]*>(.*?)<\s*/\s*${T1}\s*>,gi)
+{
$table_num++;
#warn $table_num;
next if defined $Opt{'num'} and $Opt{num} and $Opt{num} != $table_num;
$tr = "<>$tr</>" unless $T3;
my $count = 0;
- for my $td ($tr =~ m,<${T3}${exp3}[^>]*>(.*?)<\s*/\s*${T3}\s*>,gi) {
+ for my $td ($tr =~ m,<${T3}${exp3}[^>]*>(.*?)<\s*/\s*${T3}\s*>,gi)
+ {
$td = html2txt($td) unless $Opt{html};
$_ = chr(194).chr(160); $td =~ s/$_/ /g;
$td =~ s/\s+/ /g;
$td = str_trim($td);
$count++;
+
push(@col,$td);
- if (1 and $COUNT and $count > $COUNT) {
+ if ($COUNT and $count > $COUNT)
+ {
print join($Opt{sep},@col)."\n";
@col = ();
}
=head1 NAME
-$NAME - Script to extract html table into csv
+$NAME - Script to print html table into csv
=head1 SYNOPSIS