oxagast has asked for the wisdom of the Perl Monks concerning the following question:

Hi, I've been trying to do this for awhile, and can't seem to figure it out. What I have to work with is:

for $eve_one (0..scalar(@events_ns)-1) { $cur_ns = &pull_feilds_ns($eve_one); push @ns_games, $cur_ns; } for $games_ns_cart (0..scalar(@ns_games)-1) { @ns_games_rev = @ns_games; @ns_games_rev[$games_ns_cart] =~ s/(.*:.*):(.*:.*)/\1:\0/; } @ns_games_do = (@ns_games, @ns_games_rev); for $eve_two (0..scalar(@events_bb)-1) { $cur_bb = &pull_feilds_bb($eve_two); push @bb_games, $cur_bb; } @allgame = &combinations(\@bb_games, \@ns_games)}; @allgame_uniq = uniq(@allgame); return(\@allgame_uniq); }

In @bb_games and @ns_games_do is data like: Texas Rangers:1.78740157480315:New York Mets:2.15 Texas Rangers:1.78740157480315:Seattle Mariners:2.17 I want to be able to put both those sets of data into @allgame_uniq and return it to another subroutine for use like:

Texas Rangers:1.78740157480315:Seattle Mariners:2.17:Texas Rangers:1.7 +8740157480315:New York Mets:2.15

Then do:

@allgame_uniq = &permu();

so I can do something like print a line of the data with

@allgame_uniq[5].

I can't figure out how to do it, anybody have an idea?

Replies are listed 'Best First'.
Re: Getting all combinations of 2 arrays in another array
by Limbic~Region (Chancellor) on Aug 26, 2013 at 00:35 UTC