- 论坛徽章:
- 1
|
本帖最后由 yakczh_cu 于 2014-02-01 15:18 编辑
- use v5.10;
- my $html = <<'HTML';
- <table>
- <tr>
- <td class="fieldLabel" height="18"> >first </td>
- <td class="dataEntry" height="18">
- 10/27/2011
- </td>
- <td > <a href="http://www.google.com"> google <</a> </td>
- </tr>
- </table>
- HTML
- use HTML::TableParser;
- sub row {
- my( $tbl_id, $line_no, $data, $udata ) = @_;
- print "\t";
- print join("\t",@{$data});
- }
- # create parser object
- my @req=({ id => 1, row => \&row, });
- my $p = HTML::TableParser->new(
- \@req,
- { Decode => 1, Trim => 1, Chomp => 1, }
- );
- $p->parse( $html );
复制代码 回调函数中只能得到 google 相当于只有text ,怎么把链接A也一起取出来? |
|