Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: sprintf( @_ ) doesn't do what I want!

by huck (Parson)
on Oct 30, 2019 at 02:46 UTC ( #11108103=note: print w/replies, xml ) Need Help??


in reply to sprintf( @_ ) doesn't do what I want!

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.

https://perldoc.perl.org/functions/sprintf.html

  • Comment on Re: sprintf( @_ ) doesn't do what I want!

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11108103]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2020-05-27 00:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If programming languages were movie genres, Perl would be:















    Results (152 votes). Check out past polls.

    Notices?