Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Modify Data type in CSV

by graff (Chancellor)
on Aug 06, 2005 at 23:27 UTC ( #481571=note: print w/replies, xml ) Need Help??


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;

Replies are listed 'Best First'.
Re^2: Modify Data type in CSV
by DrAxeman (Scribe) on Aug 07, 2005 at 02:00 UTC
    Perfect! Thank you!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://481571]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2023-12-02 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (13 votes). Check out past polls.

    Notices?