use Cwd; my $dir = getcwd; #find root of script print "Current Directory is $dir\n"; print "Appending skudb to dir\n"; $dir = $dir . "skudb"; if (-d $dir) { chdir $dir; #move into the new directory #do some stuff in $dir here } else { mkdir $dir }