Even with your incomplete HTML, Mojo::DOM to the rescue:
#!/usr/bin/perl use strict; use warnings; use Mojo::DOM; use feature 'say'; my $html = 'Information</div><br><div class="formline"><div class="for +mlabel">FillDB File Size Limit:</div><div class="forminput">0.0% ( 0 +/ 3145728 Bytes )</div></div><div class="formline"><div class="formla +bel">FillDB File Count Limit:</div><div class="forminput">0.0% ( 0 / +10000 Files)</div></div><br><hr><div'; my $dom = Mojo::DOM->new( $html ); for my $element ( $dom->find('.forminput')->each ){ say $element->text; }
Output:
0.0% ( 0 / 3145728 Bytes ) 0.0% ( 0 / 10000 Files)
If you have the file locally, the docs show how to read it in, if you are parsing a live site, you could just combine it all at once using Mojo::UserAgent (for example).
Update: Depending on the full page you may need to alter the selector somewhat. A full example would help.
In reply to Re: Parse html file
by marto
in thread Parse html file
by TonyNY
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |