Patrick R. Michaud wrote:
> On Fri, Aug 22, 2008 at 04:34:04PM -0500, Andy Colson wrote:
>> sub xsum (@list)
>> {
>> my $i = 0;
>> print "summing: ";
>> for @list
>> {
>> $i += $_;
>> print $_,",";
>> }
>> say " = $i";
>> return $i;
>> }
>> say "sum = ", xsum( (1,2,3,4,5) );
>>
>> It returns this:
>>
>> summing: 1 2 3 4 5, = -1.2289e+09
>> sum = -1.2289e+09
>
> I suspect that Rakudo is having trouble binding array parameters
> at the moment -- so it's likely a bug in the parameter handling code
> (which I'm expecting will need some refactoring soon anyway). I'm
> guessing that Rakudo is binding @list as if it is a Scalar Array,
> and thus the for loop sees only one element.
>
> This probably deserves a tracking ticket at <[EMAIL PROTECTED]>.
Already wrote one:
[perl #58276] AutoReply: [BUG] Can't iterate over list that was passed
as a subroutine argument
Cheers,
Moritz
--
Moritz Lenz
http://moritz.faui2k3.org/ | http://perl-6.de/