Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
This probably sounds like a very basic question, but I just spent the last half-hour going through the perl documentation (and even through the system sprintf man page), and couldn't find it.
Let's suppose I have an array that I don't know the length of (or even one long enough that I don't want to write out the format for each variable). Yes, I know I could build an output string by looping over the array, but I am trying to learn about sprintf. :)
Two questions:
1. Is there some way of "repeating" a format (ie. use this parameter for the next ten variables or for all remaining variables)?
2. What happens when perl "runs out" of parameters (there are more variables to print than parameters in the format)? Does it start from the beginning (probably not), repeat the last format (think some languages do this), or just throw an error?
|
---|