gu has asked for the wisdom of the Perl Monks concerning the following question:
Then I became a little more enlightened and wrotemy @poly1_coeffs = () ; push @poly1_coeffs, 1 ; foreach (1..$n) { push @poly1_coeffs, 0 ; }
Do you see something else/shorter/better ?my @poly_coeffs = (0) x ($n + 1) ; $poly_coeffs[0]++ ;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Populating a vector
by jdporter (Paladin) on Dec 15, 2005 at 17:18 UTC | |
by gu (Beadle) on Dec 15, 2005 at 17:19 UTC | |
|
Re: Populating a vector
by bageler (Hermit) on Dec 15, 2005 at 17:56 UTC | |
by thor (Priest) on Dec 15, 2005 at 18:03 UTC | |
by bageler (Hermit) on Dec 15, 2005 at 18:18 UTC | |
by thor (Priest) on Dec 15, 2005 at 19:08 UTC | |
|
Re: Populating a vector
by blazar (Canon) on Dec 15, 2005 at 18:06 UTC |