http://www.perlmonks.org?node_id=620179


in reply to Reading two lines per loop iteration

Are you saying there are a lot of cost_time lines all together? If it's just one (i.e. they come in Day/cost_time pairs) then a simple string replacement would solve the problem. Otherwise just remember the content of the last Day line and insert the data into any subsequent ones that don't start with Day.