in reply to Conditional regex

Why would you need a conditional regex? Why not just use something like:
$contents=~s!>$! alt="text">!sig if $contents =~ m/<IMG/ && $contents +!~ m/alt/;
I'm pretty sure this can be simplified, I didn't try to.