Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^9: Pre-process csv files before using

by sk (Curate)
on Aug 07, 2005 at 03:47 UTC ( [id://481605] : note . print w/replies, xml ) Need Help??


in reply to Re^8: Pre-process csv files before using
in thread Pre-process csv files before using

You are making it complicated by doing a rename and in place edit.

I would do -

open (IN, 'origdata.csv'); # Open the file for read open (OUT,'>','copy.csv'); # Open the file for write. Will overwrite +if exists while(<IN>) { # read contents of input file # <IN>, typucally used inside a while will populate variable $_ # more proecessing print OUT ($_); # Write out to new file }

I think you should start reading more about how to work with files and other perl idioms.

I would recommend that you start with "Learning perl book". Also there are lot of stuff in Categorized Questions and Answers section!

-SK