in reply to substr regex alternative

The smallest alternative is:

Under strictures one variant is:

x

With the typo/trick question "corrected" an interesting alternative is:

$string =~ s/(\w+)$/print $1/e;
my $string = "hello world"; $string=~s/(\w+)$/print$1/e; </c>
True laziness is hard work