FOR: Windows NT 4
I want perl to read a directory. there is suposed to be two files in the folder ( file1.ini and file2.ini ) and i want perl to print "Files present" or "Files NOT present" to a text document ( report.txt )
how do i do it.?
FOR: Windows NT 4
I want perl to read a directory. there is suposed to be two files in the folder ( file1.ini and file2.ini ) and i want perl to print "Files present" or "Files NOT present" to a text document ( report.txt )
how do i do it.?
#open report.txt so text can be appended to the end of it
open (RPT, ">>reports/report.txt") || Error('open', 'file');
#check if the files exist or not
if ((-e "files/file1.ini") && (-e "files/file2.ini")) {
print RPT "Files present.\n";
} else {
print RPT "Files not present.\n";
}
#close report.txt
close (RPT) || Error('close', 'file');
#if report.txt cannot be opened, this subroutine will execute
sub Error {
print "Content-type: text/html\n\n";
print "The server can't $_[0] the $_[1] : $! \n";
exit;
}
Thanks