open (FH, "file.html");
my $find = quotemeta('here.company.com/pagedir');
## you can use quotemeta like this.
my $replace = 'there.company.com';
## also it is better to define these outside of your loop
my $outstring;
## this is a temp variable
while () {
my $string = $_;
$string =~ s/$find/$replace/g;
$outstring .= $string;
## this concatenates $string to $outstring
}
close (FH);
open (FH, ">file.html");
## > means open new file for writing
print FH $outstring;
## a plain 'print' prints to STDOUT. you want to print to
## your filehandle instead.
close (FH);