On Thu, 31 Oct 2002, Mohanty, Debi (MED, TCS) wrote:
> Hi Howard,
> I tried to run the program with my 305MB file, but I got the
> error saying "Out Of memory".
>
> The program I am using is
>
> $/ = '@F' . chr(0x0D) . chr(0x0A) . chr(0x0D) . chr(0x0A);
> open (INFILE, "<input.dat") || die "failed!";
> binmode INFILE;
> while (<INFILE>)
> {
> $_ =~ /^(\w+)(.*?)\+A/s;
> $RecordNo = $1;
> $RecordNo = substr($RecordNo,1,8);
> #print "$RecordNo\t";
> $OtherStuff = $2;
> $OtherStuff =~ s/\r\n/\<EOL\>/sg;
> #print "$OtherStuff\n";
>
> foreach $Letter (split(//,"ABCDEF"))
>
> {
> $_ =~ /\+$Letter(.*?)\@$Letter/s;
> $$Letter = $1;
> $$Letter =~ s/\r\n/\<EOL\>/sg;
> $$Letter=~s/\+g//g; # GET RID OF "+g"
> $$Letter=~s/\@g/\<EOL\>/g; # TURN "@g" INTO <EOL>
> $$Letter=~s/\n/\<EOL\>/g; # CHANGE NEWLINES INTO
> <EOL>
> #print "$$Letter\t";
>
> }
> #print "\n";
> }
> close INFILE;
>
Does your end-of-line sequence( the 6 character string you assigned
to $/) occur anywhere in your file? If not, the first <INFILE> operation
will try to read in 305MB of data into memory.
**** [EMAIL PROTECTED] <Carl Jolley>
**** All opinions are my own and not necessarily those of my employer ****
_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs