develooper Front page | perl.beginners | Postings from February 2009

Invalid conversion in sprintf "%\"

Thread Next
From:
Rob Canning
Date:
February 18, 2009 09:31
Subject:
Invalid conversion in sprintf "%\"
Message ID:
20090218173048.GA4010@goto10.org
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?

thanks

rob
--------------
rob@goto10.org
rob.goto10.org
--------------

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About