From: Tony Frasketi <[EMAIL PROTECTED]>
> Hello group
> I'm getting the following error message when running my Perl program:
>
> Out of Memory!
>
> The program reads in an ASCII file into a string variable $lines. Then
> parses $lines looking for certain types of entities as follows...
>
> while ($lines =~ s/(INSERT INTO.+?)\#<end_insert>(.+)/$2/si) {
>
> # processing goes here
>
> }
>
> No problem reading in the file. The 'Out of Memory' error occurs as
> soon as the while statement is first executed.
Yeah that's because you force Perl to do unnecessary work.
Try to change the code to:
while ($lines =~ /(INSERT INTO.+?)\#<end_insert>/sig) {
This will loop through the $lines just as well, but will not force
Perl to keep modifying the text.
HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>