in reply to Replace a line with a new one

for this type of file processing i love to use Tie::File

then the file is merely a perl array and as such can be operated with splice to dwym. :)