in reply to Prepent string a to string b if b does not start with a
$pre = "PRE"; @S = qw/Q PREQ/; s/^(?!$pre)/$pre/ for @S; say for @S; [download]
$pre = "PRE"; @S = qw/Q PREQ/; for (@S) { $_ = $pre . $_ unless 0 == index $_, $pre; } say for @S; [download]