How can I check if a file exists in Perl?

前端 未结 8 2130
忘掉有多难
忘掉有多难 2020-12-01 02:28

I have a relative path

   $base_path = \"input/myMock.TGZ\";

myMock.TGZ is the file name located in input folder. The filenam

8条回答
  •  北海茫月
    2020-12-01 03:01

    #!/usr/bin/perl -w
    
    $fileToLocate = '/whatever/path/for/file/you/are/searching/MyFile.txt';
    if (-e $fileToLocate) {
        print "File is present";
    }
    

提交回复
热议问题