1. 如何使用:
FindBin
use FindBin qw($Bin);
my $root_path = $Bin;
print "脚本的路径:$root_path\n";
Cwd
use Cwd qw(abs_path getcwd);
my $abs = abs_path(getcwd());
print "运行脚本的路径:$abs\n";
2. 它们的区别
大家一定注意到了"脚本运行路径"和"运行脚本的路径",有点绕是不是,那我们来看看上面脚本运行结果就清楚了