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}; } } #### sub DataClass::doit { my ($self, $set, $hash) = @_; $self->Sql ("SELECT * FROM $set"); while ($self->FetchRow ()) { my %x = $self->DataHash(); $hash->{$x{ID}}{$x{DataName}}= $x{DataValue}; } 1; } $Data->doit('ConfigData',\%ConfigData); $Data->doit('DicomDestinations', \%DestinationData);