in reply to foreach loops
A very elegant and general solution: use Algorithm::Combinatorics qw/.../;
For example:
use Algorithm::Combinatorics qw/combinations/; @names = ('rita', 'sue','bob', 'daisy'); my $r=combinations(\@names,2); while(my $res=$r->next){ print "@$res\n"; }
There are several other combinatorical functions to replace all these foreach loops...
|
|---|