use strict; use warnings; my $word = quotemeta "color: "; while (<>) { print "Found '$1'\n" while /$word(\w+)/g; # Find all. } __END__