You want to resolve URIs to absolute URIs. Using a robust HTML parser:
use strictures;
use URI qw();
use Web::Query 'wq';
my $PATH_BLAH = 'http://example.com/blah/';
my $html = <<'HTML';
<html><head></head><body>
<img src="../relative-link" />
<img src="yup/another/one" />
<img src="/oh/I/start/with/a/slash" />
<img src="http://example.net/absolute-link" />
</body></html>
HTML
my $w = wq $html;
$w->find('*[src]')->each(sub {
my (undef, $e) = @_;
$e->attr('src', URI->new_abs($e->attr('src'), $PATH_BLAH));
});
print $w->html;
__END__
<html><head></head><body>
<img src="http://example.com/relative-link" />
<img src="http://example.com/blah/yup/another/one" />
<img src="http://example.com/blah/oh/I/start/with/a/slash" />
<img src="http://example.net/absolute-link" />
</body></html>