use warnings; use strict; for my $color (qw(green blue red puce)) { my $text = "The color is COLOR\n"; $text =~ s/COLOR/$color/g; print $text; } #### The color is green The color is blue The color is red The color is puce