use File::Path 'remove_path'; remove_path("/path/of/dir", {keep_root => 1});