my ($current,%data) ... $current and $data{$current->{HOST}} = $current; # in 2 places $current = {HOST=>$host, IP=>$ip, BRAND=>$brand};