A Makefile suffix rule to call a similar program (which gets $BIGFILENAME from the command line) whenever a foo.txt's mtime is newer than foo.txt.idx's:
is for more than installations.
There is a neat non-perl solution to the related problem you mention of finding word locations. Gnu idutils constructs a big dbm file of distinct words and their locations for a whole directory tree. File selection and language rules are customizable. Renamed from id-utils, maintainance was resumed last year. Recommended.