Thursday, November 24, 2022

Check if a file exists using perl

 use strict;

use warnings;

sub main{

my $file='./a.txt';

if(-f $file)

{

print "$file exists\n";


}

else

{


print "$file does not exist\n";


}

}

main();

No comments:

Post a Comment