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


in reply to Seeking help for using Tie : : File in my perl program for counting bases using Active Perl 5.10.1 Build 1007

In your original program, you slurped the whole file into memory using

@DNA= <DNAFILE>
and then used the array @DNA for processing the data. Of course it would be better to write your program in a way that it reads only one line at a time, but if the logic of your application already assumes that you have the data in an array, and your program is already working well, trying Tie::File doesn't cost much, because you don't have to change a lot. Instead of opening and reading the file, you would use
tie @DNA, 'Tie::File', "your_filename_goes_here", OPTIONS_GO_HERE or d +ie "Can not tie file ($!)";
In any case, have a look at the mode option.

-- 
Ronald Fischer <ynnor@mm.st>