hi i think i made a bit of a mess explaining my problem so i am going to have another attempt :)
use Math::Combinatorics;
#this is where "permute" comes form
my @phraseA = ("%1\$s'16->^\\markup {\"A\"} ", "%2\$s16-> ", "%3\$s16-> ");
my @phraseB = ("%4\$s'''4-.^\\markup {\"B\"} ", "%5\$s8-. ", "%6\$s8-. " );
my @phraseC = ("%7\$s''2--^\\markup {\"C\"} ", "%8\$s8-- ", "%9\$s16-- ");
my @phraseD = ("%10\$s''8-+^\\markup {\"D\"} ", "%11\$s32-+ ", "%12\$s32-+ ");
my @phraseE = ("%13\$s'''1-_^\\markup {\"E\"} ", "%14\$s16-_ ", "%15\$s16-_ ",
"r16");
my @phrasegroup = ([ @phraseA ], [ @phraseB ], [ @phraseC ], [ @phraseD ], [
@phraseE ] );
#--------------------------------------------
#...@phraseperm (below) is all permutations of the 5 arrays of @phrasegroup (ie
5!)
#i would like to have these 5! permutations arranged so i can process them as
individuals
#for example i would like to write code that says do "this" to every third
permutation
#or if the permutation contains "this" do that
#in order to do this i need a "\n" at the end of each permutation
#permute is a part of the Math::Combinatorics module.
#maybe its just a strategic positioning of a ,"\n" in the line below? i cant
figure it out though - i can get line breaks after each permutation but i still
only see them as array references
(ARRAY(0x823e970)ARRAY(0x823e8e0)ARRAY(0x823e830)) etc.
and not the content followed by a line break.
my @phraseperm = map {...@$_} permute(@phrasegroup);
#flatten the array (or maybe its here that i need the "\n" ?)
my @flatphraseperm = map {...@$_, " "} @phraseperm;
print @flatphraseperm;
#i would like this file to have a line break between each permutation of
@phrasegroup
open PERMOUT, ">$0.perm";
print PERMOUT @flatphraseperm;
i hope i made at least a little more sense that time :)
thanks
rob
--------------
[email protected]
rob.goto10.org
--------------
signature.asc
Description: Digital signature
