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


in reply to Re^2: How to match last character of string, even if it happens to be a newline?
in thread How to match last character of string, even if it happens to be a newline?

> Not quite: ... "abc\nd"

in this case two options with /s modifier

DB<11> m/.*(.|\n)/s,print "<$1>" for "123","abc\n","abc\nd" <3>< ><d> DB<12> m/.*(.)/s,print "<$1>" for "123","abc\n","abc\nd" <3>< ><d> DB<13>

HTH!

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery FootballPerl is like chess, only without the dice