0
以下是我在html文件中的數據。我想找到在HTML文件中使用「HTML :: TreeBuilder作爲」使用HTML :: TreeBuilder查找html文件中的值
<table id="stats" cellpadding="0" cellspacing="0">
<tbody>
<tr class="row-even">
<td class="stats_left">Main Domain</td>
<td class="stats_right"><b>myabcab.com</b></td>
</tr>
<tr class="row-odd">
<td class="stats_left">Home Directory</td>
<td class="stats_right">/home/abc</td>
</tr>
<tr class="row-even">
<td class="stats_left">Last login from</td>
<td class="stats_right">22.32.232.223 </td>
</tr>
<tr class="row-odd">
<td class="stats_left">Disk Space Usage</td>
<td class="stats_right">30.2/∞ MB<br>
<div class="stats_progress_bar">
<div class="cpanel_widget_progress_bar" title="0%"
style="position: relative; width: 100%; height: 100%; padding: 0px; margin: 0px; border: 0px">
</div>
<div class="cpanel_widget_progress_bar_percent" style="display: none">0</div>
</div>
</td>
</tr>
<tr class="row-even">
<td class="stats_left">Monthly Bandwidth Transfer</td>
<td class="stats_right">0/∞ MB<br>
<div class="stats_progress_bar">
<div class="cpanel_widget_progress_bar" title="0%"
style="position: relative; width: 100%; height: 100%; padding: 0px; margin: 0px; border: 0px">
</div>
<div class="cpanel_widget_progress_bar_percent" style="display: none">0</div>
</div>
</td>
</tr>
</tbody>
</table>
我如何才能找到使用「HTML :: TreeBuilder作爲」值「磁盤使用空間」值。我有許多與上面的代碼相同的類的tds,
TreeBuilder是雙重有效! ;-) – simbabque
@daotoad:我用下面的代碼whichis不工作。我不能做這樣的事情 使用嚴格;使用警告;使用HTML :: TreeBuilder; my $ tree = HTML :: TreeBuilder-> new_from_file(「index.html」); my $ disk_value; my $ disk_space;對於($ tree-> look_down(_tag => q {tr},'class'=>'row-odd')){ $ disk_space = $ tree-> look_down(_tag => q {td},' class'=>'stats_left') - > as_trimmed_text;如果($ disk_space eq'主目錄'){ \t $ disk_value = \t $ tree-> look_down(_tag => q {td},'class'=>'stats_right') - > right() - > as_trimmed_text ); \t } } print STDERR「my home value is $ disk_space:$ disk_value \ n」; – Cindrella