http://www.perlmonks.org?node_id=718046


in reply to Re^2: Extract Multiple Lines from the End of a multi-line string
in thread Extract Multiple Lines from the End of a multi-line string

I tend to go for ultra portability.. and qr/(?:\r\n|\n\r|\n|\r)/s will likely handle any end-of-line scenario in the modern world. The fact that the two byte sequences (like \r\n) are tested before the single byte sequences (like \n) ensures that the correct behaviour will take place.