Not entirely true. As written here, the two are equivalent. Mr. Wheelers version is simply an implied while loop. Both will read every line of a file until an EOF is reached. Both are subject to problems if the files are very large. You could argue that both methods read the file in pieces, where piece = line, however both will suck up the files in their entirety. The one advantage of the first method might be if you were looking for a particular token in the file being read, or only wanted to read to a specific point. You could then insert logic to exit the loop and thereby abort your read before the whole file was traversed.
"Ward W. Vuillemot" wrote: > On 2002.08.10, at 08:54, David Wheeler wrote: > > > On Saturday, August 10, 2002, at 12:43 AM, Shannon Murdoch wrote: > > > >> while(<FILE>){ > >> push (@array,$_); > >> } > > > > This doesn't answer your question, but just as a space saver (perhaps > > even optimization, I'm not sure), you might want to try this syntax: > > > > my @array = <FILE>; > > Q: What happens if <FILE> is a LARGE file? @array = <FILE> may then > cause problems...the first way ensures that the file is read in > pieces.... > > Anyone have comments?