apparently, /.*\z/ tests whether a string ends in a newline:
$ perl -e 'print "there is no newline\n" if "foo\n" =~ /.*\z/'
$ perl -e 'print "there is no newline\n" if "foo" =~ /.*\z/'
there is no newline
I find this very strange. In my opinion, this regular expression should always match. Every string, even "foo\n", has an end (\z), and since .* matches zero or more horizontal characters, it should always match the empty string before the end of the string. However, it doesn't, as you can see in the first one-liner.
I found this RE in the code of Log::Handler by bloonix and I'm wondering why it works.
I've tested it in perl versions 5.8.8, 5.005_03 and 5.9.4.
Update: This perl bug is now fixed (see below). Thanks to demerphq.