in reply to Tracking down memory leaks
my @outfile; while (<INFILE>) { # Process stuff here. push @outfile, $newline; } foreach my $line (@outfile) { print OUTFILE $line; }
Why not just do something like:
That code template will grow to a fixed size and stay at that size, regardless of how many lines are in INFILE or OUTFILE.while (<INFILE>) { # Process stuff here. print OUTFILE $newline; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Tracking down memory leaks
by scain (Curate) on Apr 13, 2005 at 13:10 UTC | |
by dragonchild (Archbishop) on Apr 13, 2005 at 13:46 UTC | |
by scain (Curate) on Apr 13, 2005 at 13:56 UTC | |
by Anonymous Monk on Apr 13, 2005 at 14:48 UTC | |
by scain (Curate) on Apr 13, 2005 at 15:38 UTC |