in reply to Re: Compare each array element to the rest, sequentially
in thread Compare each array element to the rest, sequentially

Added a unique filter, in case the data contains duplicates:
use strict; use warnings; my %uniq; my @array = sort {$a <=> $b} grep {$uniq{$_}++==0} qw/ 23 45 12 4 45 8 + 7 5/; while (my $item = shift @array) { print "$item $_\n" for @array; }
(the number 45 is duplicated here, but only one appears in the output).

                All power corrupts, but we need electricity.

Replies are listed 'Best First'.
Re^3: Compare each array element to the rest, sequentially
by Laurent_R (Canon) on Dec 08, 2017 at 08:52 UTC