(silly) example:And using Damian Conway's new Quantum::Superpositions module, you can write these as:will return 1 if any two matching elements of the array satisfy the condition in the block.$res1=any { $a<$b } \@vec1, \@vec2;will return 1 if all pairs satisfy the condition.$res2=all { $a<$b } \@vec1, \@vec2;
All praise "The Damian".use Quantum::Superpositions; $res1 = any(@vec1) < any(@vec2); $res2 = all(@vec1) < all(@vec2);
-- Randal L. Schwartz, Perl hacker
In reply to Quantum::Superpositions (was RE: any-all)
by merlyn
in thread any-all
by fundflow
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |