John W. Krahn said :
> Rob Canning wrote:
>> hi i have a sprintf which uses a scalar as its format:
>> my $Bformat = "%1\$s16-> %2\$s16 %3\$s16 %4\$s16 %5\$s16 %6\$s16-> %7\$s16 
>> %8\$s16"
>>
>>
>> what i would like to do is generate a new format for the sprintf by 
>> doing permutations of 5 arrays like this:
>>
>> my @phraseA = qw( %1\$s16-> %2\$s16-> %3\$s16-> ); my @phraseB = qw( 
>> %4\$s16 %5\$s16 %6\$s16-> );
>> my @phraseC = qw( %7\$s16 %8\$s16 %9\$s16 );
>> my @phraseD = qw( %10\$s16-> %11\$s16 %12\$s16 ); my @phraseE = qw( 
>> %13\$s16 %14\$s16 %15\$s16-> ); 
>>
>> my @phrasegroup = ([...@phrasea], [...@phraseb], [...@phrasec], 
>> [...@phrased], [...@phrasee]);
>> my @phraseperm  = map {...@$_} permute(@phrasegroup);
>>
>> #flatten permutation array
>> my @Bformat = map { @$_ } @phraseperm;
>>
>> but when i do this i get :
>>
>> Invalid conversion in sprintf: "%\" at score-generator11.pl line 53.
>>
>> so i thought maybe i needed to turn the array into a scalar:
>>
>> #my $test = join(" ",@Bformat);
>>
>> but that gave the same error
>>
>> any ideas what i am doing wrong?
>
> Strings like '%1\$s16->' are not valid sprintf/printf formats.  What  
> does your data look like and what do you expect it to look like after  
> using sprintf?
>

hi,

i have put the code here http://pastebin.com/m5d4debbb  
you will see a my $formatA that works fine
and a my @App gives the error

thanks

rob

>
>
>
> John
> -- 
> Those people who think they know everything are a great
> annoyance to those of us who do.        -- Isaac Asimov
>
> -- 
> To unsubscribe, e-mail: beginners-unsubscr...@perl.org
> For additional commands, e-mail: beginners-h...@perl.org
> http://learn.perl.org/
>
>
>
--------------
r...@goto10.org
rob.goto10.org
--------------

Attachment: signature.asc
Description: Digital signature

Reply via email to