#!/usr/bin/perl -- use strict; use warnings; my $dir = "__poop"; rmdir $dir or warn $!; mkdir $dir or die $!; chdir $dir or die $!; $dir = "../$dir" ; rmdir $dir or die sprintf "Cannot rmdir($dir): %d(%s) %d(%s)", int($!),$!,int($^E),$^E; __END__ No such file or directory at test.pl line 6. Cannot rmdir(../__poop): 13(Permission denied) 32(The process cannot access the file because it is being used by another process) at test.pl line 10.