my %data; while ( more data ) { my ($ip,$domain,@times) = readNextChunkOfData(); $data{$domain}{'ip'}= $ip; $data{$domain}{'seconds'} = \@times; # the next line isn't necessary, but could be convenient # IF YOU KNOW YOUR IP/DOMAIN NAME PAIRS ARE UNIQUE. # for doing domain-from-ip lookups. $data{$ip}{'domain'} = $domain; }