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