By the way, how do you find out what the directory separator is?
File::Spec is another core module (comes with Perl) that can be used for file pathname manipulations such as splitting or combining a path into the individual directory componenets. File::Spec takes care of the details so you don't even need to worry what the directory separator is.