open FILE, "$file" or die "Can't open receipt page html file for display $!\n"; flock(FILE,2) or die "cannot lock file: $!"; # now make all image paths local and absolute. undef $/; # enable "slurp" mode my $line = ; # whole file now here $line =~ s/\n/ /g; #Strip out potentially nasty stuff. $line =~ s///sig; $line =~ s///sig; $line =~ s///sig; $line =~ s/ (<\s*(?:a|img|area)\b[^>]*(?:href|src)\s*=\s* ['"]?) ([^'"> ]+) (['"]? [^>]*>) / $1.sprintf("%s",URI->new($2)->abs($images_url)).$3 /segix; # now print the lot to the browser. print "Content-type: text/html\n\n"; print $line; close (FILE);