Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • From "perldoc -f sprintf":

    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.
    • I suspect printf and sprintf behave differently because of print/printf's non-standard prototype. sprintf is $@, as it should be. printf should also be $@ except for the filehandle oddity that can't be expressed in prototypes. It could probably be fixed these days but then the Backwards Compatibility Police will come in the night and rearrange your furniture.

      Another "print sprintf" vs "printf" surprise I noticed a while ago: printf doesn't honor $\.