|Perl Monk, Perl Meditation|
Seeking help for using Tie : : File in my perl program for counting bases using Active Perl 5.10.1 Build 1007by supriyoch_2008 (Monk)
|on Jan 30, 2012 at 05:56 UTC||Need Help??|
supriyoch_2008 has asked for the
wisdom of the Perl Monks concerning the following question:
Hi Perl Monks,
I am a beginner in perl programming. I have written a PERL program to count the number of bases in a DNA molecule from a text file in command prompt in Windows XP. The program works well with small text files having DNA sequence data and gives correct results.
But when I tried to count the number of bases from a 299 MB text file, the program shows “out of memory” in cmd after nearly 2 minutes. One Perl monk suggested me to use Tie: : File to solve this problem. I looked for the syntax of Tie : : File in internet but could not make out how to use it in my program with <STDIN> input operator assigned to a scalar variable like $DNAfilename=<STDIN>;
I have given the perl program below. May I expect to get help from any perl monk to sort out this problem in my program either using Tie : : File or other method so that I can analyze a 299MB text file. I have a 2-GB RAM in my laptop with Active Perl 5.10.1 Build 1007 version.
Can I use a code like %mem=300 MW; in perl because this type of code is used by some theoretical and physical chemists in specific programs based on c programming for “Quantitative Structure Analysis and Report (QSAR)” for biomolecules to solve memory problem?
I have given the cmd output below.
Microsoft Windows XP Version 5.1.2600
(C) Copyright 1985-2001 Microsoft Corp.
C:\Documents and Settings\user>cd d*
C:\Documents and Settings\user\Desktop>m.pl
Please type the filename of the DNA sequence data: manjur.txt
Out of memory!
C:\Documents and Settings\user\Desktop>
I am ever grateful to perl monks for their quick reply with suggestions.