質問

I need to parse a HTML file which is full of different type of div tags.

For example

<div class="..">

I think I have to use the look_down function, but don't know how to differentiate the mentioned div tags.

役に立ちましたか?

解決

You are talking about the HTML::Element module. HTML::Element objects are usually built by parsing an HTML document using HTML::TreeBuilder. Please read the documentation: it is very well written.

You need to call the look_down method like this

my @divs = $doc->look_down(_tag => 'div', class => 'myclass');

where myclass should be replaced by the value of the class attribute that you want to select.

@divs will contain a list of HTML::Element objects that match those criteria.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top