Unlike "printf", "sprintf" does not do what you probably mean when you pass it an array as your first argument. The array is given scalar context, and instead of using the 0th element of the array as the format, Perl will use the count of elements in the array as the format, which is almost never useful - sprintf.LOL... who actually knew that? I mean, ******* ****, what the ****!
sub my_sprintf { return defined $_[1] ? sprintf $_[0], $_[1] : 'MISSING'; }
In reply to Re^2: Printing non existing hash values as "missing"
by Anonymous Monk
in thread Printing non existing hash values as "missing"
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |