in reply to Re: chdir in perl
in thread chdir in perl

I'm betting there's a newline on the end of $mpath. Since newline is a valid character within (and therefore at the end of) a path, the chdir() function cannot ignore it, and will look for a path that ends in newline, which you probably don't have. Consider a chomp on $mpath.
Great catch! You just solved an hour-long headscratching for me!