Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Modify Data type in CSV

by sk (Curate)
on Aug 06, 2005 at 23:33 UTC ( #481572=note: print w/replies, xml ) Need Help??


in reply to Modify Data type in CSV

DrAxeman, In your previous post: Pre-process csv files before using, I replied with an inplace edit code. In that I use something called $. which keeps track of the current line number processed. So if you really want to do conversion of some sort then you can check for  $. != 1 and then apply the conversion for the rest of the code.

update: As graff pointed you shouldn't need the conversion function. Take this code for example

perl -e'$val = 9e-05; print "value = ", $val*2, $/;' __END__ value = 0.00018

If you find the command line version of the program confusing just focus on the pieces after -e'. Everything is a regular perl code. I am just assingning a value using scientific notation and use it in regular airthmetic and get expexted results. Unless you are doing something fancy with your conversion i wouldn't go for a module

-SK

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (3)
As of 2023-12-11 05:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?











    Results (41 votes). Check out past polls.

    Notices?