On Sun, Jan 16, 2005 at 09:27:56PM -0800, Jonathan Lang wrote:
> How would I do the following in Perl 6?

Modulo any syntax foibles, I think it'd look like this:

> 
>   if a given condition is true for every element in a list, do something.

if all(LIST) > 3 { do_something }

> 
> or
> 
>   if a given condition is true for any element in a list, do something.

if any(LIST) > 3 { do_something }

Where LIST is, of course, the actual list of things.  The exact syntax
of the conditional would change with what you wish to test.

if all(LIST) ~~ /foo/ { do_something }

if 7 < all(LIST) < 15 { do_something }

if all(LIST) eq 'fred' { do_something }


-Scott
-- 
Jonathan Scott Duff
[EMAIL PROTECTED]

Reply via email to