J
justme
hi
i have a hash with a few arrays as elements
eg
%hash = ( 1 => ("A", "B"),
2 => ("C", "D"),
3 => ("E","F"),
4 => ("G","H"),
5 => ("1","2"),
6 => ("one","two");
}
These array elements are longer strings, but i just put it here for
short as ABCD....
I wish to join up the first 4 array elements such that its output is
like this
AE, AF, BE,BF, CG , CH , DG,DH. ( key 1 and 3 will join, key 2 and 4
will join)
Then after that, the result will join with elements of key 5 and 6
(AE,AF,"1","one") , (BE,BF,"1","one"),
(AE,AF,"2","two"),(BE,BF,"2","two"), and so on ...
Can someone suggest a good algorithm to do this?
thanks..
i have a hash with a few arrays as elements
eg
%hash = ( 1 => ("A", "B"),
2 => ("C", "D"),
3 => ("E","F"),
4 => ("G","H"),
5 => ("1","2"),
6 => ("one","two");
}
These array elements are longer strings, but i just put it here for
short as ABCD....
I wish to join up the first 4 array elements such that its output is
like this
AE, AF, BE,BF, CG , CH , DG,DH. ( key 1 and 3 will join, key 2 and 4
will join)
Then after that, the result will join with elements of key 5 and 6
(AE,AF,"1","one") , (BE,BF,"1","one"),
(AE,AF,"2","two"),(BE,BF,"2","two"), and so on ...
Can someone suggest a good algorithm to do this?
thanks..