for (qw/green blue red/) { if ($color eq $_) { ... } } for each of green, blue and red: if the color is it, do something