my @list; my $sth = $dbh->selectall_arrayref('select MID,Mname from ML_Lists'); for (@$sth) { push @list,$_ if grep(/^NA$/,@$_) != @$_; }