@dissectcode2
Personally, I would take a different route. I would actually use the open() function to open the file and die if it didn't work. If it opened, make a log entry into a log and then close the file.
-
sub findText {
-
open(FILE, "../veryImportant.txt") or die "Cannot open file: $!";
-
-
print LOG "File: veryImportant.txt exists. Continuing.";
-
-
close(<FILE>);
-
}
-
Yes, the log file represented by the LOG file handle will have had to be previously opened, but that is no biggie. My point was to show you another way of doing it that didn't involve executing a system command. This, btw, would possibly work on Unix, Linux and maybe even Windows due to the lack of system level command execution.
Regards,
Jeff