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.

Regards,

David

--
David Wheeler                                     AIM: dwTheory
[EMAIL PROTECTED]                              ICQ: 15726394
http://www.kineticode.com/                     Yahoo!: dew7e
                                               Jabber: [EMAIL PROTECTED]
Kineticode. Setting knowledge in motion.[sm]



Reply via email to