We don't bite newbies here... much | |
PerlMonks |
Re^2: Determining directory where script was called fromby Athanasius (Archbishop) |
on Mar 13, 2019 at 06:08 UTC ( [id://1231194]=note: print w/replies, xml ) | Need Help?? |
Hello nysus, Glad $ENV{PWD} is working for you, but it doesn’t work for me on Windows:
On the other hand, Cwd::getcwd() [or Cwd::cwd()] works fine for me, and is a more portable solution. I tried using `getcwd()` to get the current working directory where the script was called from but it is returning undefined. Was your call to the remote script something like this?
If so, you’ll get undefined because backticks in list context returns a list (of lines; see perlop#Quote-Like-Operators). In scalar context it works as expected:
Hope that helps,
In Section
Seekers of Perl Wisdom
|
|