-6

I need a Perl script to parse a simple HTML table with 2 columns.

The table includes: column 1 Name of the user and column 2 the time that he/she has been online.

I need to get the data as: Name Time_online

I have tried HTML::TreeBuilder and HTML::Parser but without result.

I want somehow to get and manipulate this data. THANK YOU!

<h1>Users currently online</h1>
<table class="list-table" cellpadding="3" cellspacing="1" summary="Data for online_users">
<thead>
<tr class="list-header">
<th class="list-table" id="online_users_name">
User name
</th>
<th class="list-table" align="right" id="online_users_online_time_pretty">
Online time        
</th>
    </tr>
    </thead>  

    <tbody>
              <tr class="odd"> 
              <td class="list-table" headers="online_users_name">
                <a href="Link">Jack Boauldwin</a>
              </td>

              <td class="list-table" align="right" headers="online_users_online_time_pretty">
                11 minutes
              </td>
            </tr>
        <tr class="even">  

              <td class="list-table" headers="online_users_name">
                <a href="Link">Sarah James</a>
              </td>

              <td class="list-table" align="right" headers="online_users_online_time_pretty">
                1 minutes
              </td>            
          </tr>

              <tr class="odd">


              <td class="list-table" headers="online_users_name">
                <a href="Link">Greg Brown</a>
              </td>

              <td class="list-table" align="right" headers="online_users_online_time_pretty">
                0 minutes
              </td>

          </tr>    
</tbody>
</table>
4

1 回答 1

5

使用HTML::TableExtract

于 2012-04-17T08:43:22.703 回答