My first recommendation was MMM::Text::Search, but it too only tells you which file(s) the search words were found in, not where.
What are you building this for? Wouldn't a simple brute force loop be enough if you are only dealing with one file?
my $match = qr/thunderbird/i; open FILE, '<', 'foo.txt' or die $!; while (<FILE>) { if ($_ =~ $match) { my @word = split /\s+/, $_; $_ =~ s/[A-Za-z0-9_ ]//g; for my $i (0..$#word) { if ($word[$i] =~ $match) { print "match found on line $. word ", $i+1,"\n"; } } } }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
In reply to Re: Simple Text Indexing
by jeffa
in thread Simple Text Indexing
by cyocum
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |