Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use perl to determine whether a file exists

Shulou Source: shulou.com Published: 2022-06-01 13:03:08 09月29日 Update

This article is about how to use perl to determine whether a file exists or not. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Use perl to determine whether a file exists

Use perl to determine whether a file exists:

#! / usr/bin/perl-w

My $file = "/ home/zl/study/perl/fileexist/t.txt"

If (- e $file) {

Print "t.txt exist.\ n"

} else {

Print "do not exist.\ n"

}

After judging the success, you can continue to do other processing on the file.

If you determine whether the directory exists, you need to use-d.

Thank you for reading! This is the end of this article on "how to use perl to determine whether a file exists". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!

Tags: Files content more articles good practical successful articles catalogs read knowledge reference processing help related Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker NVidia Redmi MariaDB Xiaomi