in reply to Getting around nested conditionals
...the way to do this is to have a row/col -> values mapping, sort that and loop. Ie.| 1-2 4-8 ---------------- 1-2 | a b 4-8 | c d 16-32 | e f
my $row_map = [{min => 1, max => 2}, {min => 4, max => 8}, {min => 16, max => 32}]; my $row = undef; for (0..2) { if (($row_map->[$_]->{min} <= $y) && ($row_map->[$_]->{max} >= $y)) { $row = $_; last } }
|
|---|