Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help parsing html file 2

Status
Not open for further replies.

CFtaxtron

Programmer
May 26, 2001
19
CA
Someone help me and tell me why this sucker isn't displaying the title of the returned page.

use LWP::Simple;

$url = '
# this will get the HTML text
$content = get($url);

# parse the Title tag from the HTML
while ($content =~ /<title.*?\/title>/gis) {
print &quot;Getting $1<br>&quot;;
get($1);
}

Thanks

Tim
 
In your pattern match the $1 variable will contain the chars matched in your first set of paren's. You don't have any paren's. So, $1 is never set.

while ($content =~ /<title.*?\/title>/gis) {
print &quot;Getting $1<br>&quot;;

while ($content =~ /<title.*?>[red]([/red].*?[red])[/red]<\/title>/gis) {
print &quot;Getting $1<br>&quot;;


keep the rudder amid ship and beware the odd typo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top