arunagiri has asked for the wisdom of the Perl Monks concerning the following question:

I am a basic user of perl to sort files etc: I am using glob in the following context foreach $element (glob "../../dir1/dir2/*/dir3/filename"){ print "$element\n"; } I am getting the Complete path. How can I get only the folder names inside dir2? Is there any easy way to get it?