my %Control = ( ConfigData => \%ConfigData, DicomDestinations => \%DestinationData ); for my $set (qw/ConfigData DicomDestinations/) { $Data->Sql ("SELECT * FROM $set"); while ($Data->FetchRow ()) { my %x = $Data->DataHash(); $Control{$set}{$x{ID}}{$x{DataName}}= $x{DataValue}; } }