Unfortunately, I have not tried anything yet. It's more like I am just thinking of how I should do it. Below is the idea that I was thinking.
in reply to Re: How to Get the Last Subdirectories
in thread How to Get the Last Subdirectories
Create a recursive hash and store each subdirectory as a key.
Loop through the recursive hash and place the 'directory' in a new hash. So, if the key is already in the new hash, then continue to the next one.
But the above idea might be making things complicated. I was wondering if there is a simple approach to this or I may just be over complicating the problem.