Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

by davido (Cardinal)
on Oct 30, 2019 at 04:10 UTC ( [id://11108105]=note: print w/replies, xml ) Need Help??


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

As odd as this may seem, it nevertheless works:

sprintf($_[0], @_[1..$#_])

...or...

sprintf(shift, @_)

perlsub explains prototypes, and that's what's going on here. You can see the prototype for sprintf like this:

perl -E 'say prototype(q{CORE::sprintf})' $@

Dave

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2024-04-25 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found