in reply to Generating all possible combinations from an AoA

use 5.010; sub mix {@_ ? map {my $x = $_; map "$x$_", mix(@_[1..$#_])} @{$_[0]} : + ""} say for mix @array;

Replies are listed 'Best First'.
Re^2: Generating all possible combinations from an AoA
by thargas (Deacon) on Apr 13, 2011 at 12:08 UTC

    I like this one best. A nice simple recursive function using map.

      Just don't use it on a problem of interesting size, as it requires the entire list to be in memory at once.

      - tye