in reply to sprintf using variables for format and variables to do a search and replace, sprintf issues

From the block of code, lack of vertical spacing and unclear question, I think this is one line you are asking about...

$mod_string =~ s/$find/sprintf($replace,$var_list)/e;

I would start by isolating just that line of code and printing out $find and $replace to ensure they contain what you think they do.

Looking at your code it appears $replace is 'b$2$1s'. This has backreferences so $find has to contain capture groups. If this is not the case you will get "Not enough arguments for sprintf".

  • Comment on Re: sprintf using variables for format and variables to do a search and replace, sprintf issues
  • Select or Download Code