Can you help with this perl error?

Namecheap AuctionsNamecheap Auctions
NamecheapNamecheap
Namecheap AuctionsNamecheap Auctions
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
Close
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
Close
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
Close
well if you're looking for a regex:
my ($title) = ($content=~m@<title>\s*(.*?)\s*</title>@is);
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
Domain Recover
CryptoExchange.com

NamePros updates

A browser tab with a favicon next to the page title
Search members
You can now search for members by name, company, location and more. Open the search at the top of any page and choose Members. You will...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back