in reply to perl beginner question
Perhaps the remove_tree function from the File::Path module (it's a core module) would be of interest here.
Martin