in reply to count the number of occurrences of a pattern in a file

Single quotes do not interpolate, double quotes do interpolate (\n becomes a newline only in double quotes, aka interpolation). perlintro
  • Comment on Re: count the number of occurrences of a pattern in a file