How to get the absolute path of running perl script?
Method1:
use File::Basename;
my $dirname = dirname(__FILE__);
Method2:
use Cwd 'abs_path';
print abs_path($0);
Method3:
if ENV is defined then
$ENV{SCRIPT};
Labels: perl convert relative path to absolute, perl dirname, perl get absolute path, perl get directory of script, perl parent directory, perl remove last directory from path
0 Comments:
Post a Comment
Note: only a member of this blog may post a comment.
<< Home