my @sets = ( [qw( a c f g e h i )], # X [qw( a b c d e f g h i )], # Y [qw( a c d e f g h i )], # Z ); #### X Y Z a a a b c c c d d e e f f f g g g e h h h i i i #### my @idx = ( [0, undef, 1, undef, undef, 2, 3, 4, 5, 6], # X [0, 1, 2, 3, 4, 5, 6, undef, 7, 8], # Y [0, undef, 1, 2, 3, 4, 5, undef, 6, 7], # Z ); #### my @sets = ( [qw( a b c f g )], # X [qw( a b d f g )], # Y [qw( a b e f g )], # Z ); #### X Y Z a a a b b b c d e f f f g g g