Re: whats wrong with this code?

2008-08-22 Thread Larry Wall
On Fri, Aug 22, 2008 at 05:30:19PM -0500, Andy Colson wrote: > Moritz Lenz wrote: > > The recommended way to write such a sub is > > > > sub xsum([EMAIL PROTECTED]) { ... } > > xsum(|@x); > > Ahh, but, if I already had a list, would that flatten and then rebuild > the list, correct? (and would, e

Re: whats wrong with this code?

2008-08-22 Thread Moritz Lenz
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";

Re: whats wrong with this code?

2008-08-22 Thread Patrick R. Michaud
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 =

Re: whats wrong with this code?

2008-08-22 Thread Andy Colson
Moritz Lenz wrote: Hi Andy, you seem to have discovered a whole bunch of bugs at once :/ Andy Colson wrote: 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: "; f

Re: whats wrong with this code?

2008-08-22 Thread Moritz Lenz
Hi Andy, you seem to have discovered a whole bunch of bugs at once :/ Andy Colson wrote: > 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: "; >

whats wrong with this code?

2008-08-22 Thread Andy Colson
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"; re