# First build us a 'user' key so that our %iphash # can get the username. foreach (keys %hash) { $hash{$_}->{user} = $_; } @iphash{map { $hash{$_}->{'Framed-Address'} }, keys %hash } = values %hash;