Hello All,

I need to search a particular string in a set of files in a directory. The
string appears only in one of the files in the directory.
I need to retrieve the file name and then access the line of that
particular file in which the string occurs.

NOTE: The perl script also resides in the same directory.

For Eg: I am in search of string $string = "PERL_BEGINNER";
i have a directory => /Users/ and the files in that directory are:
                            1. Beginners.h
                            2. Learners.h
                            3. Experts.h
                            4. etc....

Among these files $string occurs only in one of the files. If we assume that
it occurs in "Beginners.h"

then Beginners.h has to be opened and the $string has to be searched in that
file.

Can i know how i can go about this in Perl? What functions i might have to
use?

I kindly request to guide me in this.

Thanks and Regards,
Dharshana

Reply via email to