I have been trying desperately to help this individual but the data is a
mess and requirement continues to change. The $/ was set based on data I
received. Then I am told of this memory error. When I ask if the data format
was the same, I was told yes. After receiving a chunk of the file with which
the memory error occurred, I saw the file/record format was completely
different. The change in $/ is the main issue that caused the memory issue.
It can be changed, but the only other end of record indicator that seems
important is "@F" and it was seen to repeat multiple times without the rest
of the record. I instructed Debi to get a better handle on the data
structure so the code could be properly adjusted.

Howard A. Bullock
Global IT Infrastructure
717-810-3584


-----Original Message-----
From: Carl Jolley [mailto:cjolley@;iac.net] 
Sent: Thursday, October 31, 2002 11:25 PM
To: Mohanty, Debi (MED, TCS)
Cc: [EMAIL PROTECTED]; Bullock, Howard A.
Subject: Re: Please help: Out of Memory

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

Reply via email to