Hi All,
I am new to Perl with a problem but no solution. I wanted to create a perl script that only opens a text file and search for a particular word. Unfortunately, the script cannot open the text file. It returns the following error message:
No such file or directory.
The text file "test.txt" und perl script are in the same folder. I am using Apache Friends.
Here is the script:
use strict;
my $file_to_open = "test.txt";
open (FILE, "< $file_to_open")
or die "File cannot open! $!\n";
my $text;
undef $/; $text = <FILE>;
while ($text =~m/African/g) {
print "The word African is found.\n";
}
close (FILE);
TEXT FILE:
African african African Dating - Pride and Ambition
It is no secret that African culture is known for its pride.
Most Africans do not have a problem standing up for their beliefs and
WORD TO FIND:
African
Please any idea on how to resolve this problem?
Thanks
Ranky