in reply to return a word next to the word you give

No need to slurp it all into memory. Use something like (untested):
use strict; use warnings; my $word = quotemeta "color: "; while (<>) { print "Found '$1'\n" while /$word(\w+)/g; # Find all. } __END__

Abigail