g******1 发帖数: 295 | 1 在path1下有个文件夹叫.dir1, 我的perl script myscript.pl在path2下,
在myscript.pl中我想打开.dir1,
opendir DOT, '.dir1' or die("Can't open .dir1 for scanning.\n");
但在path2下运行myscript.pl始终显示"Can't open .dir1 for scanning.\n"
在myscript.pl中看$ENV{PATH}中已经有path1
print "Current PATH is: ", $ENV{PATH}, "\n";
请问是什么原因?谢谢。 | w******p 发帖数: 166 | 2 opendir doesn't consider PATH.
you can use either the full path to dir1, or use the FinBin module to find
where your binary is, and use relative pathing to get to dir1 | g******1 发帖数: 295 | 3 thanks
【在 w******p 的大作中提到】 : opendir doesn't consider PATH. : you can use either the full path to dir1, or use the FinBin module to find : where your binary is, and use relative pathing to get to dir1
|
|