for (my $i = 0; $i < @first_half; $i++) { s/\Q$first_half[$i]\E/$second_half[$i]/; }