in reply to Permutation and comparison loop
It only shows the relationships in one directly, but it works:
use strict; use warnings; <DATA>; # Header my @images = map {chomp; [split ',']} <DATA>; for my $i (0..$#images) { for my $j ($i+1..$#images) { # Test for Min > Max for outside of range. next if $images[$i][1] > $images[$j][2] || $images[$j][1] > $images[$i][2] || $images[$i][3] > $images[$j][4] || $images[$j][3] > $images[$i][4]; print "$images[$i][0] overlaps $images[$j][0]\n"; } } __DATA__ Image number,minlat,maxlat,minlon,maxlon 1,0,30,20,50 2,10,30,70,90 3,70,80,40,50 4,40,70,20,50 5,20,75,40,80
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Permutation and comparison loop
by spacegeologist (Initiate) on Apr 20, 2011 at 23:14 UTC | |
by BrowserUk (Patriarch) on Apr 21, 2011 at 01:45 UTC | |
by LanX (Saint) on Apr 20, 2011 at 23:31 UTC | |
by wind (Priest) on Apr 21, 2011 at 09:09 UTC | |
by BrowserUk (Patriarch) on Apr 21, 2011 at 09:43 UTC | |
by wind (Priest) on Apr 21, 2011 at 14:05 UTC | |
by BrowserUk (Patriarch) on Apr 21, 2011 at 15:21 UTC |