in reply to Re: Pascal triange...
in thread Pascal's triangle...
No need to copy rows. Here's a much smaller function:
sub pascal { my @row; foreach (1 .. shift) { push @row => 1; $row [$_] += $row [$_ - 1] for reverse 1 .. @row - 2; print "@row\n"; } }
Abigail
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Pascal triange...
by Abigail-II (Bishop) on Jun 19, 2002 at 17:04 UTC | |
by Burak (Chaplain) on Dec 25, 2003 at 14:35 UTC | |
Re: Re: Pascal triange...
by kiat (Vicar) on Jun 19, 2002 at 13:40 UTC | |
by Abigail-II (Bishop) on Jun 19, 2002 at 13:59 UTC |
In Section
Seekers of Perl Wisdom