while() { chomp; my ($objid,$other) = split(/\s+/,$_); while(my ($key,$value)= each (%hash_table)) { if($objid =~ /$key/i) { print "$key is present in $objid\n"; } else { next; } } }