CPU: Perl, Fall 2005 Perl, Week 4: More Arrays, Context, Subroutines, Lexical Variables #21

printf with Arrays

my @numbers = 28, 48.21, 20, 0.1;
my $format  = "Numbers are " . 
    ("%.2f " x @numbers) . "\n";
printf $format, @numbers;
Copyright © 2005 Ian Langworth