@known = sort byIndex(@known); splice(@known,(the correct Index),1,$newValue); sub byIndex{ $a->{'Attribute'} <=> $b->{'Attribute'}; } print "Done\n";