> I thought this would do the trick:
>
> if($wholefile =~ /^\s*$keyword\s*$/)
This could be a \n issue. Do you chomp $wholefile before the match?
If you don't want to chomp it, then try:
if ($wholefile =~ /^\s&$keyword\s*\n$/)
> This works, but is not as specific as I would like:
>
>
You might do better to make an altenation:
$keywords = join("|", @keywords);
if ( $wholefile =~ /^\s*($keywords)\s*$/mo ) { # do you want 'i' ?
rather than the loop. Worth a benchmark, but one search for multiple
matches is probably faster than multiple searches for some sized files.
You als
Craig Cardimon wrote:
I'm searching a text file for keywords. These keywords are stored in
an array. First, I read the file into a scalar variable. Then, I
search for each keyword, cycling through the array in an outer
foreach loop: foreach $keyword (@keywords)
The keywords should be in all caps a
Craig Cardimon <[EMAIL PROTECTED]> wrote:
I'm searching a text file for keywords. These keywords are stored in an
array. First, I read the file into a scalar variable. Then, I search for
each keyword, cycling through the array in an outer foreach loop:
foreach $keyword (@keywords)
The keywords