hello,
i am new to this list and very new to pearl.
i have run into a problem i cant find a solution - i have searched the net for an answer but as i am so new to perl (and programming in general) perhaps i dont even know the right keywords...

ok here it goes..

use Math::Combinatorics;

 my @n = qw(tomfl toml tomml tommh tomh);
 my @permutations = (join(" ",map { join " ", @$_ } permute(@n)),"\n");

ok so i use permute spews out all the combinations of @n into the array @permutations - i think i have screwed up at this point - i think its just firing it into the first index of the array as a string?

what i need is an @array i can use as a list in sprintf

 sub InsertPitches {
   my ($num, $form, @notes) = @_;
   my ($output, @temp);
  while (@notes) {
     (@temp[0..$num-1], @notes) = @notes;
     $output .= sprintf $form, (@temp);
   }
   return $output;

InsertPitches(15, $format, @permutations)

if i hardcode @permutations it works fine:

my @permutations = qw(tomfl toml tomml tommh tomh tomfl toml tomml tommh tomh etc. etc. etc.);

but i need @permutations to come from permute(@n) and to be readable by sprintf in the sub InsertPitches

i think its just a problem with the way i am formating this line:
 my @permutations = (join(" ",map { join " ", @$_ } permute(@n)),"\n");

can anyone help?

many thanks

rob




--
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