John Carter wrote: > > From the MacPerl list a while back > > > > > This code gives me an out of memory error > > > > print "Please select a file to view: "; > > chomp($file_name = <STDIN>); > > > > open(FILE, "$file_name"); > > @newsgroups = <FILE>; > > print @newsgroups; > > close FILE; > > It strikes me that there should be a fun way to mmap the file. > ... > Anybody ever done this? > > John Carter EMail: ece@dwaf-hri.pwv.gov.za It strikes me that mmapping it won't help any; the problem is that you're duplicating your entire file (newsgroups is it? That can easily be thousands of lines. Mine is 5136, a third of the length of the "active" file which holds the list of all news groups innd is carrying. And we're only carrying things in English. The problem is trying to slurp that file. An obvious solution is to NOT SLURP THINGS BIGGER THAN YOU CAN STORE IN MEMORY and a way to do that is by respecting the file pointer idiom and processing way-big files a line at a time. ________________________________________________________________________ David Nicol 816.235.1187 UMKC Network Operations david@news.umkc.edu "on a 80x24 character cell terminal in a damp basement, under a bare light bulb, perched atop a backless wooden stool." ==== Want to unsubscribe from Fun With Perl? ==== Well, if you insist... Send mail with body "unsubscribe" to ==== fwp-request@technofile.org