my @system_attributes = qw(memory cpu disk network); [...] my $hashref = $nodemetrics{'server1'}; @$hashref{@system_attributes}=@data;