in reply to Re^2: Regex triggering uninitialised values
in thread Regex triggering uninitialised values

Then you'd have
$str =~ s/(\d*)%var%(.*)/$1REPLACED$2/;
Although, unless you're going to use $1 and/or $2 later, there's no reason to have them at all.
$str =~ s/%var%/REPLACED/;