Hi List --
I'v started playing around with perl 6, and I am having problems with
this example:
use v6;
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
Looks like the "for @list" has one element in it, "1 2 3 4 5".
I'v tried:
say "sum = ", xsum( (1,2,3,4,5) );
and
say "sum = ", xsum( [1,2,3,4,5] );
and
my @x = (1,2,3,4,5);
say "sum = ", xsum( @x );
I'm using:
This is Rakudo Perl 6, revision 30434 built on parrot 0.7.0-devel
Thanks,
-Andy