What do you want to happen if there is more than one file with the keyword? The (non-perl) grep utility is the usual way to solve this problem.
Guessing that you don't have system grep, you should generate a list of all filenames of interest with glob. Then open each and loop through the contents trying to match the keyword with the match operator, m/APPLES/. If a match is found, note the filename and go on to the next. That can be done in a way that generates an array of qualified files, using push.
After Compline,
Zaxo
In reply to Re: Get Filename using perl
by Zaxo
in thread Get Filename using perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |