in reply to Grabbing a Web Page and Replace Variables

OK, you probably want treat the whole page as one string (s modifier), and add the i modifier to add case insensitivity.

Like this (changed delimiter - I find | easier on the eye:

$webpage =~ s|href="$_|href="thedomain/$_|gis

Although, I'd probably use this (assuming all links are relative URLs):

$webpage =~ s|<HEAD>|<HEAD><BASE href="thedomain/">|is;

to add a BASE HREF for the page.

.02

cLive ;-)

Replies are listed 'Best First'.
Re: Re: Grabbing a Web Page and Replace Variables
by LostS (Friar) on May 04, 2001 at 23:56 UTC
    What is I am doing is grabing a page... Then I am saying Hey look for any places you find the <img src="whatever"> tag and insert int he <img src="... make it now say <img src="http://www.domain.com/whatever.gif"> I don't always know the picture name or the web page it is pointing to thus I need to specify the assign the rest of that line to a $_ or some variable to append the to.