in reply to Re: Compare each array element to the rest, sequentially
in thread Compare each array element to the rest, sequentially
(the number 45 is duplicated here, but only one appears in the output).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; }
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 |