if (rmdir "D:\\tmp\\xpcd") { print "removed D:\\tmp\\xpcd"; } else { print "failed to remove D:\\tmp\\xpcd"; } perl test.pl dir D:\tmp\xpcd ...shows a file listing