in reply to Re^4: adding an index column to a csv data file
in thread adding an index column to a multi-array derived from a csv data file
You could build the array while reading the data
poj#!/usr/bin/perl use strict; use warnings; my @AoA = (); # ArrayOfArrays while (<DATA>){ s/\s//g; my @tmp = split ',',$_; $tmp[0] *= 1.0; $tmp[1] /= 1.0; $tmp[2] = $.; push @AoA,\@tmp; } printf "%e,%e,%d\n",@$_ for @AoA; __DATA__ 0.00000000e+00, 2.41644835e+00 1.20048018e-04, 2.38938189e+00 2.40096037e-04, 2.36473989e+00
|
|---|