According to Jon S. Jaques: > > On my PowerBook 540 w/12mb ram, I get an 'Out of memory!' error on the > following, while reading in a 5mb ASCII file: > > open(IN, "$hostname:Desktop Folder:allfiles.txt"); > open(OUT, ">$hostname:Desktop Folder:allfiles2.txt"); > > @LINES = <IN>; > print OUT join(' ', @LINES); > > close IN; > close OUT; > > Using the afore mentioned read methods, MacPerl duplicated the file in 20 > seconds. This is probably because if your read in a 5mb file, you've actually got 5.5mb of information (with string and array handling overhead). Then the JOIN command forces MacPerl to create a new 5mb string. This give you somewhere around 11mb being used by MacPerl. System 7.0 and later use a minimum of 2mb to run (mine uses 12mb). 11mb + 2mb > 12mb. Your PB crashes and burns. Quit trying to do everything in memory at one time. Systems with small memories should work on one or two lines of information at a time. This keeps your overhead down. So to rewrite your program: open( IN, "$hostname:Desktop Folder:allfiles.txt"); open(OUT, ">$hostname:Desktop Folder:allfiles2.txt"); while( <IN> ){ chomp; print $_; } print "\n"; close IN; close OUT; This does the same thing, but on a single line at a time basis. ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch