Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: $nextline not working

by McA (Curate)
on Mar 22, 2013 at 03:54 UTC ( #1024863=note: print w/ replies, xml ) Need Help??


in reply to $nextline not working

Hi,

a solution based on many assumptions:

#!/usr/bin/perl use warnings; use strict; use Data::Dumper; use lib './lib/lib/perl5'; use Mojo::DOM; my $html = q( <html> <head><title>Some list</title> </head> <body> <div> <table> <tr> <td>Borrower:</td> <td>Someone</td> <td>active date:</td> <td>2013-03-22</td> <td>Amount:</td> <td>100.00</td> </tr> <tr> <td>Borrower:</td> <td>SomeoneElse</td> <td>active date:</td> <td>2013-03-20</td> <td>Amount:</td> <td>10.50</td> </tr> </table> </div> </body> </html> ); my $dom = Mojo::DOM->new($html); my $table = $dom->at('table'); for my $record ($table->children('tr')->each) { my %record = map { $_->text } $record->children('td')->each; print Dumper(\%record), "\n"; }

McA


Comment on Re: $nextline not working
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1024863]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2014-09-16 22:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (51 votes), past polls