in reply to Both read and write to file
You could use Tie::File which would allow you to tread the file as if it were an array... just a thought...