David Wheeler wrote:

On Tuesday, November 18, 2003, at 06:11 PM, Joseph Ryan wrote:

Not to be a jerk, but how about:

   my $is_ok = 1;
   for @array_of_random_values_and_types -> $t {
       if not some_sort_of_test($t) {
           $is_ok = 0;
           last;
       }
   }
   if $is_ok {
       yada() # has sideeffects...
   }


Isn't that just:

    for @array_of_random_values_and_types, 'ok' -> $t {
        when 'ok' { yada(); last }
        last unless some_sort_of_test($t);
    }

IOW, the topic is only 'ok' when all of the items in the array have been processed, which in your code is what happens when some_sort_of_test($t) returns a true value.


And also if @array_of_random_values contains 'ok'.

- Joe



Reply via email to