Print current directory using Perl

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

    Just remove the '$0'

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

提交回复
热议问题