The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
#!/usr/bin/perl -w
# printf - format and print data

use strict;

END {
    close STDOUT || die "$0: can't close stdout: $!\n";
    $? = 1 if $? == 255;  # from die
} 

unless (@ARGV) {
    die "usage: $0 format [argument ...]\n";
} 

my $format = shift;
eval qq(printf "$format", \@ARGV);
die if $@;

__END__

=head1 NAME

printf - format and print data

=head1 SYNOPSIS

B<printf> I<format> [ I<argument> ... ]

=head1 DESCRIPTION

The B<printf> command uses the first argument as the format that describes
how to print the remaining arguments.  Unlike the standard 
printf(1) command, this one uses the Perl version, which means
that the C<\v> escape is not supported, but various other things are.
See L<perlfunc/sprintf> for details.

=head1 RESTRICTIONS

This command should not be used in setuid programs as it does not run
untaint its argments and will trigger errors like C<Insecure dependency
in eval while running setuid at /opt/ppt/bin/printf line 16.>

=head1 SEE ALSO

printf(3), L<perlfunc/sprintf>

=head1 AUTHOR

Tom Christiansen, I<tchrist@perl.com>.

=head1 COPYRIGHT and LICENSE

This program is copyright (c) Tom Christiansen 1999.

This program is free and open software. You may use, modify, distribute,
and sell this program (and any modified variants) in any way you wish,
provided you do not restrict others from doing the same.