Hacker News new | ask | show | jobs
by hf 2238 days ago
One particularly mnemonic collection of switches is 'plane':

    perl -plane 'my $script' 
which iterates over all files given on the command-line (or stdin) and

  + (p)rints every processed line back out
  + deals with (l)ine endings, in and out
  + (a)utosplits every line into @F
I am aware that -n and -p are mutually exclusive, but as -p overrides -n, it's seems simpler to just keep 'plane' in mind and remove the 'p' if necessary.