-pAnd so, accordingly, you should be using the -n switch (wraps your script in a loop w/o the print statement) in place of the -p.causes Perl to assume the following loop around your program, which makes it iterate over filename arguments somewhat like sed:
1. LINE:
2. while (<>) {
3. ... # your program goes here
4. } continue {
5. print or die "-p destination: $!\n";
6. }If a file named by an argument cannot be opened for some reason, Perl warns you about it, and moves on to the next file. Note that the lines are printed automatically. An error occurring during printing is treated as fatal. To suppress printing use the -n switch. A -p overrides a -n switch.
BEGIN and END blocks may be used to capture control before or after the implicit loop, just as in awk.
In reply to Re: regexp matching bad stuff ...
by kennethk
in thread regexp matching bad stuff ...
by raiten
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |