printf doesn't really care whether the arguments are integers or not, it cares about what the size flags immediately precede. If you use the following code:
use warnings;
printf "%4.4i\n", 1;
printf "%4.4li\n", 1;
printf "%4.4hi\n", 1;
printf "%4.4qi\n", 1;
printf "%4.4Li\n", 1;
printf "%4.4lli\n", 1;
You then almost get the results that are predicted in the perldocs:
0001
0001
0001
Invalid conversion in printf: "%q" at - line 5.
%4.4qi
0001
0001
(the zeroes are there because 4.4 ensures that the number will be 4 digits long in the case of an int)
Of course, there's still that rogue q that doesn't work in 5.6.1 or 5.8.0. However, since q should be the same as L and ll, it's not like Perl is lacking some feature--they just lie about q being a valid alias.
Again: l and h should only be used when followed by i, never by f. Perl, C, and GNU all appear to agree on this.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.