use warnings; use strict; use File::Path qw(rmtree); my $dir = 'example'; rmtree $dir or die "can't remove the damned dir $dir!";