Programming-Idioms

History of Idiom 43 > diff from v3 to v4

Edit summary for version 4 :

Version 3

2015-05-06, 21:04:50

Version 4

2015-07-31, 19:50:58

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Idiom #43 Break outer loop

Look for a negative value v in 2D integer matrix m. Print it and stop searching.

Code
OUTER:
for my $i (0 .. $#m) {
   for $j (0 .. $#{$m[$i]}) {
      if ($m[$i][$j] == $v) {
         print "$v\n";
         last OUTER;
      }
      }
}