Perl's "open" function was designed to mimic the way command-line redirection in the shell works. Examples:
Any white space before or after the filename is ignored.
$ myprogram file1 file2 file3Can have all its files opened and processed one at a time using a construct no more complex than:
| "FILE" | open FILE for input. Also "<FILE". |
| ">FILE" | open FILE for output, creating it if necessary. |
| ">>FILE" | open FILE in append mode. |
| "+<FILE" | open FILE with read/write access (file must exist). |
| "+>FILE" | open FILE with read/write access (file truncated). |
| "|CMD" | opens a pipe to command CMD; forks if CMD is -. |
| "CMD|" | opens a pipe from command CMD; forks if CMD is -. |