If you're willing to invest a few minutes in learning about modules (HTML::Parser
come to mind -- follow the link to CPAN) rather than a few minutes banging your head against the wall figuring out how to catch corner cases with regular expressions, it will pay off greatly.
If all of the HTML is very similar and not too tricky, you can use a regexp like:
$line = s!(<img src=")[^"]+([^>]*">)!$1$newimage$2!gi;
to do your substitution. Be warned, using regular expressions on HTML is very tricky, unless you're dealing with extremely consistent HTML.