in reply to What is sprintf doing?

From the error message, I'd say that the value from the $_ =~ m[,\s+(\d+)] isn't a number. It looks like the match m[,\s+(\d+)] is failing.