my (%abs, %ilb); for my $lc ( Sql ( 'select blah blah1 - but just put a list of test values will do' ) ) { my ( $ln, $pos, $key ) = split /\t/, $lc; $abs{ $key } = {}; # just want a hash reference for now } for my $lc ( Sql ( 'select blah blah2 - for testing: test values that have an intersection with the first set' ) ) { my ( $ln, $pos, $key ) = split /\t/, $lc; $ilb{ $key } = { pos => $pos, abs => defined( $abs{ $key } ) }; # this hash is about to get used immediately in the unwritten code to follow }