lightoverhead has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I have a question regarding the "v" flag for "printf".
printf "<%vd>","123";
I thought the result should be "<1.2.3>", but instead it was "<49.50.51>".
As it was described, "This flag tells Perl to interpret the supplied string as a vector of integers, one for each character in the string. Perl applies the format to each integer in turn, then joins the resulting strings with a separator (a dot . by default)"
I assume "123" will be divided as vector of ("1","2","3"), but it became ("49","50","51").
I am confused!
in addition if I want printf to output result of "100 200 300" of string "100200300" what should I do?
Thanks you!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: question regarding "v" flag of printf
by rjt (Curate) on May 23, 2013 at 05:15 UTC | |
by lightoverhead (Pilgrim) on May 23, 2013 at 16:22 UTC | |
by Anonymous Monk on May 23, 2013 at 16:48 UTC | |
by lightoverhead (Pilgrim) on May 23, 2013 at 16:57 UTC | |
by Anonymous Monk on May 23, 2013 at 17:55 UTC | |
| |
|
Re: question regarding "v" flag of printf
by choroba (Cardinal) on May 23, 2013 at 05:56 UTC |