my $pwd = `pwd`; print $pwd; my ($parent_dir) = $pwd =~ m|^(.*)/[^/]+.*$|g; print $parent_dir;