in reply to Question regarding Tie::File or a better way to handle huge 2-D arrays

I think the most efficient solution would be to open the file in read/write mode, then seek to the position where you want to put "test", then write it.

This should not be hard because your lines are of constant length, so you can easily compute the byte position of your target string. However you should take care on certain operating systems that treat "\n" as more than one character.

Tie::File still has to search for the newlines, and (afaik) it operates on whole lines; as I understand it, your lines are much longer than your columns, so this is still very unefficient.

  • Comment on Re: Question regarding Tie::File or a better way to handle huge 2-D arrays