Base on the content of your @list:
my $data = {};
foreach my $item ( @list )
{
my $span = $tree->look_down( _tag => 'span' );
my $title = $span->as_trimmed_text() . $span->right();
for my $row ( $tree->look_down( _tag => q{tr} ))
{
my @keys = $row->look_down( _tag => q{th} );
my @vals = $row->look_down( _tag => q{td} );
for ( my $i = 0; $i < scalar @keys; $i++ )
{
my $key = $keys[ $i ]->as_trimmed_text();
my $val = $vals[ $i ]->as_trimmed_text();
$data->{ $title }{ $key } = $val;
}
}
}
print 'data: ' . Dumper( $data );
}
Result:
data: $VAR1 = {
'CS 128 Section 01 ' => {
'Capacity' => '30',
'Building/Room' => '8 52',
'Title' => 'Introduction to C++',
'Time' => "3:00 PM\x{2013}4:50 PM\
+x{a0}\x{a0}\x{a0}TuTh",
'Class Nbr' => '11647',
'Units' => '4'
}
};
Look at
HTML/Element for more info
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.