in reply to Obtaining terms in an expansion
It's not clear to me what you want. Maybe it's something like
my $C; if (@$ar) { $C = 1; foreach my $row (@$arr) { my $sum = 0; foreach my $ele (@$row) { $sum += $ele; } $C *= $sum; } }
By the way, you shoulnd'y use $a and $b as variable names to avoid conflicts with some special variables.
Update: Or maybe
my $cols = @{$arr->[0]}; my $C; foreach my $col_idx (0 .. $cols-1) { $C->[$col_idx] = 1; foreach my $row (@$arr) { $C->[$col_idx] *= $row->[$col_idx]; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Obtaining terms in an expansion
by randyk (Parson) on Jan 05, 2006 at 22:03 UTC | |
by BrowserUk (Patriarch) on Jan 06, 2006 at 00:26 UTC | |
by InfiniteSilence (Curate) on Jan 05, 2006 at 22:54 UTC |