use File::Basename; ($name, $path, $suffix) = fileparse($fullname, @suffixlist) fileparse_set_fstype($os_string); # $os_string specifies os type $basename = basename($fullname, @suffixlist); $dirname = dirname($fullname); ($name, $path, $suffix) = fileparse("lib/File/Basename.pm", '\.pm'); fileparse_set_fstype("VMS"); $basename = basename("lib/File/Basename.pm", ".pm"); $dirname = dirname("lib/File/Basename.pm"); ***** ($name, $path, $suffix) = fileparse('/virgil/aeneid/draft.book7', '\.book\d+'); ***** $name eq 'draft' $path eq '/virgil/aeneid', $suffix eq '.book7' ***** ($name, $path, $suffix) = fileparse('Doc_Root:[Help]Rhetoric.Rnh', '\..*'); ***** $name eq 'Rhetoric' $path eq 'Doc_Root:[Help]' $suffix eq '.Rnh'