[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Read Speed



At 05:07 PM 12/14/97 +0100, Johan Almqvist wrote:
>On Sat, 13 Dec 1997, Jon S. Jaques wrote:
>> open(IN,  "$hostname:Desktop Folder:allfiles.txt");
>> open(OUT, ">$hostname:Desktop Folder:allfiles2.txt");
>> @LINES = <IN>;
>> print OUT join(' ', @LINES);
>> close IN;
>> close OUT;

>Why does everyone always load the entire file into memory?

Yes, I know, that was actually my point... I had proposed the following as
a 'workable:'

#!perl
open(IN,  "$ARGV[$i]");
open(OUT, ">nodup.tab");
	while(read(IN, $buf, 32768)) {
		print OUT $buf;
	}
close IN;
close OUT;


--Jon S. Jaques
--The Grove Hill Pages
--http://www.grovehillsys.com
--jjaques@grovehillsys.com
--jjaques@illuminata.com
--jjaques@almus.com

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch