LOOPS: for $i (1..10) { for $j (1..10) { for $k (1..10) { # Process $data[$i][$j][$k] here last LOOPS if $data[$i][$j][$k] < $threshold; } } }