Fortunately for all of us, the designers of the Unix operating system realized that the notion of “solving problems by the combined efforts of many little programs” was a very potent way to solve a problem (even on a very small computer). So they made it very easy to do just that.
The first brilliant simple idea they had was this: Every program has a “standard input” (STDIN), “standard output” (STDOUT), and “standard error-output” (STDERR) file associated with it. “The output of” any program is automagically sent to “its STDOUT,” which defaults to the screen, and it accepts its input from “its STDIN,” which defaults to the keyboard. (It “pukes” to “its STDERR,” which also defaults to the screen.) Period. End of sentence. Every program works that way.
The second brilliant idea follows from the first: the STDOUT of one program can effortlessly be “piped into” the STDIN of the next program down the line. (Which can, of course, be “Perl itself.”) This makes it extremely easy to use the output of one program as the input to another ... no “magic incantations” required.
Unix: making amazingly complex things simple since 1969.
(Windows, which has been “making simple things complicated” since somewhat-later, grudgingly followed suit. More or less.)
|