in reply to replace comma for dot re. calculation
Bitten by over thinking the plumbing. Change the colsMap line to:
$table->colsMap( sub {$_->[0] =~ s/,/\./g; $_->[2] = $_->[0] * $_->[1] + } );
and the code prints:
Numbers,Values,Result 100.20,2,200.4 18.20,3,54.6 19.45,2,38.9 7.25,2,14.5
which I suspect is what you were after.
The result of $_->[0] =~ s/,/\./g is true (1) if there was a match. You were expecting the resulting value of $_->[0] perhaps?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: replace comma for dot re. calculation
by GertMT (Hermit) on Jun 22, 2007 at 10:01 UTC |