in reply to Prepent string a to string b if b does not start with a

What do you mean by brute forcing this?
$pre = "PRE"; @S = qw/Q PREQ/; s/^(?!$pre)/$pre/ for @S; say for @S;
or
$pre = "PRE"; @S = qw/Q PREQ/; for (@S) { $_ = $pre . $_ unless 0 == index $_, $pre; } say for @S;