On Thu, 7 Feb 2002, Brian Hayes wrote: > It appears the problem was using the foreach statement instead of while. > I have not tested this extensively, but using foreach the whole text > file (or output of pipe) is read into memory before continuing, but > using while (and probably for) each line is processed as it is read. Yes indeed it does, because foreach operates on a list, where as while operates on a boolean value returned from an expression (which means scalar context). So if you do foreach(<FILE>) { } It will put <FILE> into the list context and slurp the entire thing up into a list. 'for' will do the same thing. It also operates on a list (foreach and for are aliases for each other). -- Brett http://www.chapelperilous.net/ ------------------------------------------------------------------------ As you grow older, you will still do foolish things, but you will do them with much more enthusiasm. -- The CowboyThread Previous | Thread Next