in reply to Failed to open file for write

File::Spec may be exceptionally helpful as well.