Loop Through Input With -p

LINE:
  while (<>) {
      ...             # your program goes here
  } continue {
      print or die "-p destination: $!\n";
  }
fortune | perl -pe 's/mark twain/MARK TWAIN/i'

It usually takes more than three weeks to prepare a good
impromptu speech.
          -- MARK TWAIN