if (grep /$_/, @{$tbl{$i}} ) { #### while (my $line = ) { ... for my $i (...) { if (grep /$line/, @{$tbl{$i}}) { ... } } }