Take a look at splitpath in File::Spec
In reply to Re: Dissecting a complete pathname to a file by GrandFather in thread Dissecting a complete pathname to a file by Anonymous Monk