Sorry still not clear! (And unfortunately you didn't update your posts with code-tags either).
- If you want the whole sub-path which fills into the wild-card, then the demonstrated code is already perfect. Try it out.
- If you're only interested in the highest level folder do a @folders = split '/', $path for every path found by your glob and just take $folder[$index], where index is the number of folders in the "head" part.
E.g 4 for "../../dir1/dir2/" will give you the next directory after "dir2".
( addicted to the Perl Programming Language)