next up previous contents
Next: -e: Execute script from Up: Command Line Flags Previous: -n: Automatic while-loop   Contents

-p: Automatic while-loop with printing

The -p flag is just like the -n flag, except the following statement is executed for each iteration of the loop, right after your program is executed:
     print $_;
In other words, the -p flag allows you to modify input from a file or the keyboard, and have the modified result print to standard output, making it easy to use perl as a stream editor, like the program sed, mentioned in Section 1.1



Phil Spector 2002-10-18