my @tableData = grep ref($_) eq "ARRAY" && # make sure we have an arrayref $_->[0] =~ /\S/ && # first cell non-empty $_->[1] =~ /\S/, # second cell non-empty @$some_data;