Print current directory using Perl

后端 未结 7 2154
走了就别回头了
走了就别回头了 2020-12-29 05:53

I have this code to print the current directory using Perl:

use Cwd qw(abs_path);
my $path = abs_path($0);
print \"$path\\n\";

But it is di

相关标签:
7条回答
  • 2020-12-29 06:26

    You could use FindBin:

    use FindBin '$RealBin';
    print "$RealBin\n";
    

    FindBin is a standard module that is installed when you install Perl. To get a list of the standard pragmatics and modules, see perldoc perlmodlib.

    0 讨论(0)
提交回复
热议问题