Thought I'd throw another way out there. Take a look at
File::Spec, you can use the
splitpath() method to seperate the filename from the path, then use the
splitdir() method to break the path apart into seperate directories. You can then just remove the first two directories (perhaps checking to make sure that they are the same directories you were expecting to remove) and put them back together with
catdir(). This approach has the advantage of being cross-platform and working with different directory names easily.