>>544
perldocより
If "RECURSE" is *true* then "rmdir" will attempt to delete everything inside the directory.
rmdir($dir, 1);
で良いんじゃなかろか。試してないけれど