But you can see why that's happening, right? That *is* the first element of a dot-separated list, innit? So what you probably need to do is to revise your thinking slightly, and approach it from "how do I get rid of the last element of a list" (the file extension is the last element of a dot-delimited list.
How do you delete stuff from a list?
--
Adam