If efficiency is defined by keystrokes, you may save a few by using capturing parens in your split. You may also rely on the fact that the -n flag loads one line at a time into $_, and that split looks at $_ if no other string param is provided:
echo www.perlmonks.org.split.reduce.code.check |perl -lnE 'say reverse
+ split /(\.)/'
So this is 36 keystrokes if you start counting after the pipe. Someone will probably beat it though. One way to beat it will be eliminating two unneeded whitespace characters, so this gets it down to 34:
echo www.perlmonks.org.split.reduce.code.check |perl -lnE'say reverse
+split/(\.)/'
If efficiency is defined by some other metric, you would probably need to benchmark a few alternatives according to that metric to determine which one wins.
|