in reply to how do I get the directory name from the pathnames
devlele there is a module File::Basename to accomplish this job. Take a look into that module.
Prasad