in reply to Search thru directories of .c & .h files for @Constants
The bits you need to get started are File::Find to scan for the files and something like the following code to build a regex used in the search:
use strict; use warnings; my @constants = qw(foo bar baz); my $match = '\b' . join ('\b|\b', @constants) . '\b'; while (<DATA>) { print if /$match/; } __DATA__ A foo line no hit bar line barren line No food here foo_bar_baz doesn't hit too
Prints:
A foo line bar line
|
|---|