in reply to binary search/replace

Is that literal data? If so, you might get by using index and substr.

When using regexes, it's safest to use quotemeta — failure to do so may be the cause of why it didn't work for you:

s/\Q$cut/$replace/;