http://qs1969.pair.com?node_id=481571


in reply to Modify Data type in CSV

I'm not entirely sure what you're asking for here. Your code looks okay, but I really wonder about the parts that are commented out -- the net effect is that I'm not sure what you're trying to do.

If your question involves reformatting the data that comes out of the second query (for averages), I'm not sure why you need to do this; if a scalar variable is assigned a "string" value like "9.9871239340160043e-005", and then use that variable in an arithmetic operation, it just works as a number, and you don't need to do any explicit conversion yourself.

But in general, if you're wondering how to do things to values as you move them through a hash slice assignment, that is what "map" is for:

@avgsHash{ @cols } = map { some_conversion($_) } @avgs;