in reply to Re: reuse worth it for small items?
in thread reuse worth it for small items?
The map doesn't buy you much in terms of golf here, and he's also changing the target hash. I'd probably approach it something more like:
my @table_to_hash = ( [ "ConfigData", \%ConfigData ], [ "DicomDestinations", \%DestinationData ] ); for (@table_to_hash) { my ($table, $hash) = @$_; $Data->Sql("SELECT * FROM $table"); while ($Data->FetchRow ()) { my %x = $Data->DataHash(); $hash->{ $x{ID} }{ $x{DataName} } = $x{DataValue}; } }
Update: I see this is almost the same as Zaxo's post at Re: reuse worth it for small items?, but note that mine will maintain the order. I'm not sure it matters, but it could.
|
|---|