Your index() solution does not do exactly what the regex solution does. That may or may not make a difference in this application, but I think worth pointing out. The regex is "greedy" and will wind up matching the last occurrence of $version. Your index() code will find only the first occurrence of $version.
Try tybalt's code with:
$path = "/some/path/3.5.2+tcl-tk-8.5.18+sqlite-3.10.0/a/b/3.5.2+tcl-tk
+-8.5.18+sqlite-3.10.0/c";
# and you will see that only the last "/c" is deleted.
/some/path/3.5.2+tcl-tk-8.5.18+sqlite-3.10.0/a/b/3.5.2+tcl-tk-8.5.18+s
+qlite-3.10.0
As far as maintainability and understandability goes, I would not use the \K and prefer the more common way:
instead of :
$path =~ s/.*\Q$version\E\K.*//s;
I probably would have coded:
$path =~ s/(.*\Q$version\E).*/$1/s;
I think \K is specific to Perl or at least I know that it does not exist in some other regex dialects that I use.
From the use case presented, the speed of execution doesn't matter at all. I would opt for simplicity and avoid uncommon things like \K. I could code a faster, better version of your index() approach in ASM and it would run like a "super rocket" but to absolutely no effect whatsoever upon total program execution time. And I think this could miss use cases involving wide characters which the regex will handle as part of Perl (the one byte per character assumption although extremely useful for many things, it does have some limitations).
I don't know why the /s regex modifier is used and the rationale behind that could be a bit obscure? Normally "." matches anything except \n. /s allows "." to include the "\n". I would not expect to see an \n in a path name. I'm not sure that this makes any difference at all, but again, some of these small things can matter depending upon the circumstances.