my @data = ( ["1.6","2.2","3.4","3.6","5.4","6.2","7.1", "8.1", "9.0"], [ 1, 2, 5, 6, 3, 15, 4, 3, 4], [ sort { $a <=> $b } (1, 2, 5, 6, 3, 15, 4, 3, 4) ] ); # create a hash of refs to the things you want to updated. # This is only needed for the example, so that we can # use the ininialized array above. Normally, the hash is just updated # each time a new element is added to the arrays in IcrData(). for $idx (0..$#{$data[0]} ) { $data_refs_hash{$data[0][$idx]} = \$data[1][$idx]; } print join(", ", @{$data[1]}), "\n"; IncrData("3.4"); IncrData("3.5"); IncrData("9.5"); IncrData("1.1"); IncrData("9.5"); print "\n"; print join(", ", @{$data[0]}), "\n"; print join(", ", @{$data[1]}), "\n"; print join(", ", @{$data[2]}), "\n"; #produces 1.1, 1.6, 2.2, 3.4, 3.5, 3.6, 5.4, 6.2, 7.1, 8.1, 9.0, 9.5 1, 1, 2, 6, 1, 6, 3, 15, 4, 3, 4, 2 1, 1, 1, 2, 2, 3, 3, 4, 4, 6, 6, 15