|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
Re: search for a pattern in file without opening the fileby Corion (Pope) |
| on Jan 29, 2007 at 10:01 UTC ( #597057=note: print w/ replies, xml ) | Need Help?? |
|
Well, you need to search through the files' contents instead of searching through the files' names. For example by using the external grep utility or by actually opening the file, reading its contents and looking for the stuff you want. There is no way to find out about the contents of a file without opening it and reading it.
I also notice that you use /^source*/ as your search pattern. This most likely doesn't do what you want unless you want to match all strings starting with sourc (no e). Update: Added the part about opening the file
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||