I'd like to program a wrapper around printf(...)
.
My first attempt was:
sub printf2 {
my $test = sprintf(@_);
print $test;
}
As the array (in scalar context) isn't a format string, this doesn't work (as expected).
Does anyone know a solution? Probably without using any special packages?
EDIT: In the real context, I'd like to use sprintf
. Apparently there is a difference between printf
and sprintf
.
How about this
sub pf { printf $_[0],@_[1..$#_] }