in reply to How to extract text present in 3 lines within the HTML tags
HTML::Parser comes with an example specifically for that: htitle
However, I'd probably go with HTML::TreeBuilder::XPath:
use HTML::TreeBuilder::XPath; use strict; use warnings; my $data = do {local $/; <DATA>}; my $tree = HTML::TreeBuilder::XPath->new; $tree->parse($data); print $tree->findvalue('//title'); __DATA__ <html> <head> <title> This is a very good site for regular Expressions. Very helpful. Thanks. </title> </head> <body> <p>Hello world</p> </body> </html>
|
|---|