in reply to •Re: prepend string to entire array
in thread prepend string to entire array

Works, but I need @array2 to contain all possible combinations. Such as:
A1 B1 C1 D1 E1 F1 G1
A2 B2 C2 D2 E2 F2 G2
A3 B3 C3 ..........
  • Comment on Re: •Re: prepend string to entire array

Replies are listed 'Best First'.
3Re: prepend string to entire array
by jeffa (Bishop) on Sep 10, 2003 at 01:59 UTC
    Um, don't you think you should have stated that in your orginal question? :|

    But i do find it amusing that you asked merlyn for code that does combinations. ;)

    UPDATE:
    Limbic~Region pointed me to Re: Character Combinations in which he links to a module tye wrote, Algorithm::Loops. Give it a look.

    jeffa

Re: Re: •Re: prepend string to entire array
by antirice (Priest) on Sep 10, 2003 at 02:09 UTC

    I'm in a good mood.

    @array = qw(A B C D E F G); @array1 = qw(1 2 3 4 5 6 7); @array2 = map { my $c=$_;map "$_$c", @array } @array1;

    Hope this helps.

    antirice    
    The first rule of Perl club is - use Perl
    The
    ith rule of Perl club is - follow rule i - 1 for i > 1