my $sortby = 9; my @revsort_colids = (0..4, 9, 18); my $revsort = 'no'; foreach my $colid (@revsort_colids) {    if ($sortby == $colid) { $revsort = 'yes'; last; } } print "$revsort\n";