Modify a line by adding and deleting few coloumns using perl script inline : I am writing a perl script where i know which columns are to be removed and and where it needs to be added. e,g I have a array called `deleteColumn` which contains a which number column is to be deleted.Similarly i have array called `AddColumn` which contains information about at which location something needs to be inserted.

Things is i have a line where columns are separated by comma (,). An e.g of this would be 
      
     1,2,3,5,9,7,8,12
     Now value in array deleteColumn is say [4,7] which means i have to 
     delete element 9 and 12 .And value in array AddColumn is say [3,5]
     these addColoumn indicates an empty addition i.e ','. So after deletion
     and addition finally the output should look like 1,2,3,,5,,7,8. 
     How can i achieve this inline as i would need to read around GB's of   
     files ( combined size ) and operate on them . Can this be done inline ?
     I am reading file line by line. 