What's a slick way to enumerate all subarrays of length n from a master 
array of length m? For example I've been enumerating all possible two 
card hands from a deck of 52 cards (n=2, m<=52) using nested for loops:
for ( $i = 0 ; $i < $#deck ; $i++ ) {
        for ( $j = $i+1 ; $j <= $#deck ; $j++ ) {
                someMethod( $deck[$i] , $deck[$j] )
        }
}
How do I clean this up and generalize it to larger hands (longer 
subarrays).

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to