Infinite lists in Perl  © Copyright 1997 The Perl Journal.
Reprinted with permission.  Infinite Lists  Many of the objects
we deal with in programming are at least conceptually infinite
---the input from the Associated Press newswire, for example, or
the log output from a web server, or the digits of pi. There's a
general principle in programming that you should model things as
simply and as straightforwardly as possible, so that if an
object is infinite, you should model it as being infinite, with
an infinite data structure.  Of course, you can't have an
infinite data structure, can you? After all, the computer only
has a finite amount of memory. But that doesn't matter. We're
all mortal, and so we, and our programs, wouldn't really know an
infinite data structure if we saw one. All that's really
necessary is to have a data structure that behaves as if it were
infinite.  A Unix pipe is a great example of such an object---
think of a pipe that happens to be connected to the standard
output of the yes program. F