Hi,

I have a csv file. I wanted to do some calculations on some of its fields,
like multiplying the 7th field with the 13th field and overwriting the 13th
field with the answer of my calculation.

Regarding this, can I do the calculations on the input file and overwrite it
after calculating, or I will have to open the output file and write into it?
I am asking this because I will have several files in the directory. So, I
will have to read the directory using readdir,  and process each file. It is
better if I open the file in read-write mode, process it and overwrite the
file. Just wanted to know if it is safe?

Please guide on how to get started with this?

Also can I do something like below:-


while ($line=readline($IN_FILE))
    {
        my @cdr=split (/,/, $line) ;
        $cdr[13] = $cdr[6]*5 ; ###Can I do something like this
    }

Thanks,
Mihir

Reply via email to