in reply to Re: help writing simple perl script
in thread help writing simple perl script

Actually this one almost gets me all the way there, but ends up printing out a lot of redundancy. I only want any given pair of numbers to appear only ONCE in the output (regardless of the order).

In other words, for 4 numbers, instead of:

1 2
1 3
1 4
2 1
2 3
2 4
3 1
3 2
3 4
4 1
4 2
4 3

...I'd want the output to be:

1 2
1 3
1 4
2 3
2 4
3 4

Is there a way to do this without using the Math::Combinatorics module (I don't have permissions to install Perl modules, and hate having to go through our IT admin, so would like to avoid this if possible)

Replies are listed 'Best First'.
Re^3: help writing simple perl script
by traveler (Parson) on Jul 27, 2006 at 20:23 UTC
    Ahh, ok, different problem. Just change the inner loop to
    foreach my $j ($i..$#arr){