http://www.perlmonks.org?node_id=11135057


in reply to Re^4: Getting the absolute path of a script, without PWD (bug?)(update)
in thread Getting the shell's version of working directory, without PWD's help

> The question is why is bash's pwd defaulting differently inside Perl?

From qx

Similarly to system, if the string contains no shell metacharacters then it will executed directly.

Not sure what is included into "shell metacharacters" but a simple semicolon seems to suffice to force execution via the shell ...

lanx@ubuntu14-large:/tmp/sym$ perl -MCwd -E'say `pwd;` ' /tmp/sym lanx@ubuntu14-large:/tmp/sym$ perl -MCwd -E'say `pwd` ' /tmp/dir lanx@ubuntu14-large:/tmp/sym$

update

simplified code

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery