a1 =3D ["a", "b", "c"]
a2 =3D ["1", "2", "3"]

a1.product(a2)
# =3D> [["a", "1"], ["a", "2"], ["a", "3"], ["b", "1"], ["b", "2"],
["b", "3"], ["c", "1"], ["c", "2"], ["c", "3"]]

a1.product(a2).map {|a| a.join }
# =3D> ["a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3"]

a1.product(a2).map(&:join)
# =3D> ["a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3"]
# same as above

# If you want to different things with one element
a1.product(a2).map {|el1, el2| el1.upcase + el2 }
=3D> ["A1", "A2", "A3", "B1", "B2", "B3", "C1", "C2", "C3"]

Best regards,
Abinoam Jr.

On Wed, Dec 18, 2013 at 10:57 PM, Ammar Ali <ammarabuali / gmail.com> wrote:
> On Dec 19, 2013, at 3:37 AM, Mike Lerner <lists / ruby-forum.com> wrote:
>> I have 2 arrays like so:
>>
>> arr1 =3D [a, b, c]
>> arr2 =3D 1, 2, 3]
>>
>> I want to get:
>>
>> [a1, a2, a3, b1, b2, b3, c1, c2, c3]
>
> Here=92s one way:
>
>>> a1 =3D %w{a b c}
> =3D> ["a", "b", "c"]
>>> a2 =3D %w{1 2 3}
> =3D> ["1", "2", "3"]
>>> a1.map {|c1| a2.map {|c2| c1 + c2} }.flatten
> =3D> ["a1", "a2", "a3", "b1", "b2", "b3", "c1", "c2", "c3=94]
>
> HTH,
> Ammar
>