in reply to without looping, check if $var is found in @list
my @choices = qq(one two three four five); my %choices; $choices{$_}++ for @choices; while ($sth->fetch) { if (exists $choices{$var}) { # } } [download]