my %hash = ( 'one' => 1, 'two' => 2, 'three' => 3, 'four' => 4, 'five' => 5); my %dependencies =( 'one' => [], 'two' => [], 'three' => ['four'], 'four' => ['one','two'], 'five' => ['three']);