Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by rovf (Priest)
on Jan 30, 2012 at 08:57 UTC ( #950719=note: print w/ replies, xml ) Need Help??


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>


Comment on Re: Seeking help for using Tie : : File in my perl program for counting bases using Active Perl 5.10.1 Build 1007
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://950719]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (20)
As of 2015-07-28 14:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (256 votes), past polls