in reply to regexp matching around a word
my @words = split /\s+$WANT\s+/, $text;
Now, you have the text on either side of "blue". Use my @other_words = split ' ', $foo; to get at the other words.
A regex is overkill and very unmaintainable. Keep it simple!
|
|---|