in reply to Add Hash Key Based on Matching Another Key
What about using a nested hash instead of the array? That will save you the lookup-loop when updating an element...
my %data; # btw.: never call your structure "data" in "real progra +ms" ;-) my $mac = "11:22:33:55:66:77"; $data{$mac}{ap_name} = "AP one"; $data{$mac}{ap_model} = "1131"; my $mac2 = "00:00:00:00:00:00"; if (exists($data{$mac2}) { $data{$mac2}{serial} = "FTX12345"; }
HTH, Rata
|
|---|