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


in reply to How to match last character of string, even if it happens to be a newline?

That's what you want? :)
$ perl -e' m/.*(.|\n)/,print "<$1>" for "123","ab\ c\n"' <3>< >$

Please note that \n is often not one but two characters, like on Unix CR LF

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