
| Contents |
|||||||||||||||
| [an error occurred while processing this directive] |
8.2 STDIN and Redirection
Up until this point we have assumed that Input from a file can achieved using "<" I/O redirection on the command line when we invoke our Perl script. For example, assuming we had called the above example .showtext. and given it appropriate execute permissions it could be invoked as follows:
Assuming you are on a Linux or UNIX based system this should result in the contents of the /etc/passwd file being displayed in the terminal window as if the user had typed it in on the keyboard../showtext < /etc/passwd Output from other programs can similarly be redirected as input to a Perl script using the pipe (|) command. For example to divert the output from the .ls. command:
This will display the output from the ls -l command as though it too was typed by the user at the keyboard.ls -l | ./showtext |