parsing - i want to extract table data in a html file using perl -


i'm novice programmer. have around 100 html files , each file have extract data different rows , store separately. wrote following code, 1 please me figure out flaws.

#!/usr/bin/perl -w  use strict; use warnings; use html::tableextract ; my$te = html::tableextract->new(headers => [qw('compound' 'name' 'adduct' 'adduct mw (da)' 'compound mw (da)' 'delta')]) ; @files = </home/akhila/sta/hmdb_hits/com_pks_stn/*.html>; foreach $files(@files){   $te ->parse_file($files) or die "cannot parse file";   foreach  $ts ($te->table()){     print "table(", join(',', $ts->coords),"):\n";     foreach  my$row($ts->rows()){       print join(',', @$row), "\n";     }   } }        

you need read how quota operators works in perl. try next code , immediatelly see problem.

use strict; use warnings; use data::dumper; use html::tableextract;  $te1 = html::tableextract->new(headers => [qw('compound' 'name' 'adduct' 'adduct mw (da)' 'compound mw (da)' 'delta')]) ; print dumper $te1->{headers};  $te2 = html::tableextract->new(headers => ['compound', 'name', 'adduct', 'adduct mw (da)', 'compound mw (da)', 'delta']) ; print dumper $te2->{headers}; 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -