Print current directory using Perl

后端 未结 7 2155
走了就别回头了
走了就别回头了 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:13

    Here is one simple solution:

        use Cwd;
        my $cwd = cwd();
        print "Current working directory: '$cwd()'";
    

    I hope this will help.

提交回复
热议问题