sub get_actual_dir { my ($path) = @_; if(chdir "$path") { # CDing into a directory and then calling /bin/pwd should normalize whatever # strange input might be given to us by the user. my $actual_dir = `/bin/pwd`; chomp $actual_dir; return $actual_dir; } else { die "Can't cd into <$path>: $!\n"; } }