in reply to Re^2: Unable to match newline
in thread Unable to match newline

perl -0777 -e 'somecode' will slurp the whole file when you read it with a diamond operator. See perlrun - but single-liner-ing your code isn't always a good thing for readability and maintainability