I have csv file and i want to modify some field's value. I tried by creating new csv with modified value and then renamed with original one but i want to open that file in read/write mode and do simultaneously(no rename). Here is what i tried but not successful. Thanks in advance.
sub modifying_csv { my $file=shift; open FH,"+<$file"; while(<FH>) { my $line= $_; if($line =~ /43950635/) { $line =~ s/(.*)(43950635)(.*)/"$1$2BIM$3"/; $line =~ s/\"//g; #print "$line"; print FH "$line"; } } close FH;
In reply to Modify csv file. by bimleshsharma
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |