Dynadot .com transfer sale, only $10.12 with coupon code DYNA12, available while supplies last, ends October 1, 2026.

Can you help with this perl error?

SpaceshipSpaceship
SpaceshipSpaceship
NamecheapNamecheap
Watch

Barrucadu

Established Member
Impact
64
Perl Question

edit: Fixed original error, now I need help with something else

-----

How can I get the title of a page with LWP?
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
You can use the TokeParser:

This assumes the content is returned to $content
Code:
$parser = HTML::TokeParser->new(\$content);
$parser->get_tag("title");
$title = $parser->get_token;
print $title->[1], "\n" if $title;

Or you could grep $content to find what's between the title tags.
 
0
•••
I've tried grep - but there is a problem:

Code:
@title = grep("<title>[a-z]</title>",$content);
push(@filetitles,@title);

But that always returns "HTTP::Request=HASH(0x1a8dab0) "

edit: fixed, used the wrong method for getting the content
 
Last edited:
0
•••
well if you're looking for a regex:
my ($title) = ($content=~m@<title>\s*(.*?)\s*</title>@is);
 
0
•••
DomainEasy: white label portfolios are live. Enable yours.

We're social

Escrow.com
Spaceship
Escrowly
CryptoExchange.com
Domain Recover
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back