[Chicago-talk] A bug in 5.8.3?

Jim Thomason jthomasoniii at yahoo.com
Tue Mar 30 16:01:01 CST 2004


I think I found a bug in perl. It's inconsistent, at
the very least. Andy? Something to add to a test
suite?

#!/usr/bin/perl

my @x = ("I will format a number - %d. Then a float -
%f. Then a string - %s\n", 14, 3.14159, "such as this
one");

printf(@x);

my $formatted_x = sprintf(@x);

print "$formatted_x\n";

my $formatted_x2 = sprintf($x[0], @x[1..$#x]);

print $formatted_x2;

kal-el:~ jim$ ./foo.pl
I will format a number - 14. Then a float - 3.141590.
Then a string - such as this one
4
I will format a number - 14. Then a float - 3.141590.
Then a string - such as this one

Note - printf works fine with an array, sprintf puts
the array into scalar context, and finally sprintf
operates just fine with a list.

This is 5.8.3 under MacOS X. The stock 5.8.1RC3 as
well as 5.6.1 under linux show the same behavior.

So, before I look like a nitwit by running off and
notifying the proper authorities and requesting it be
fixed, are there any obvious (or not so obvious)
explanation for this behavior that I'm missing?

-Jim....

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html



More information about the Chicago-talk mailing list