On 8/31/07, Hunter Barrington <[EMAIL PROTECTED]> wrote:
> so i have the following code:
>
> foreach my $node (@tables){
>     my @rows = $node->look_down(_tag => 'tr');
>     foreach my $row (@rows){  #grabbing data from each row at this point
>             my @part_cell = $row->splice_content(3, 1); #part number
>             my $cell = $part_cell[0];
>             next unless defined($cell);
>             my @children = $cell->content_list();
>             #my $part_number =  @children[-1];
>             foreach my $child (@children){
>                     #if (ref($child ne "HASH")){
>                     print $child, "\n\n";
>                     }
>
>             #my $parts = {$part_number => +{'part_number' =>
> $part_number, 'part_image' => '', 'description' => '', 'documents' => '',
>             #'RoHS' => '', 'availability' => '', 'pricing' => '',
> 'list_price' => ''}};
>             }
>     }
>
> i need to be able to grab just the plain text part of the 4th td tag in
> each column and assign it to $part_number
> right now $child always gives back two things, the part number i want
> and HTML::Element=HASH(0x....)
>
> how do i get what i want? hopefully thats clear, any help would be
> greatly appreciated!

I believe you want the as_text method.  You can read about it here

http://search.cpan.org/~petek/HTML-Tree-3.23/lib/HTML/Element.pm#$h->as_text()

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to