next up previous contents
Next: -p: Automatic while-loop with Up: Command Line Flags Previous: -w: Show Warnings   Contents

-n: Automatic while-loop

The while loop described in Section 1.4 is so useful that the -n flag allows you to just write the inside of the loop, and perl will automatically supply the rest. So when you use the -n flag, here's where the program you write actually fits in:
     while(<>){
        --- your program is executed here ----
     }
This sort of thing was the default behavior of the program awk, mentioned in Section 1.1.



Phil Spector 2002-10-18