in reply to extracting file names

If that's what you want to do, and your platform is Unix (or cygwin) you don't need perl at all. Try this in any bourne-like shell (eg. bash):

(for f in `cat full_path_list_file`; do dirname $f; done) | sort -u
Where full_path_list_file is the name of your file. The sort -u ensures that you get a unique list (ie. duplicates removed).