$VAR => { City-Center1=> { Data-items for first combination } City-Center2=> { Data-items for second combination } ... } #### my %city_center_hash; # Loading the data structure -- while { ($variables) = split data line my $this_key = "$o_city|$o_tcenter"; # select an # appropriate # separater $city_center_hash{$this_key} = { data_item1 => variable1, data_item2 => variable2, # ... data_itemN => last_variable, }; } # .... # .... # Retrieve the data from the data-structure foreach $cc_combo (sort keys %city_center_hash) { my ($this_city, $this_center) = split /\|/, $cc_combo; my $these_data = $city_center_hash{$cc_combo}; my $variable_item1 = $these_data -> {data_item1}; # Do something with the names and the first # data variable # etc .... }