in reply to substr regex alternative

my $string = "hello world"; print $string =~ /(.{5})$/; #Or print $string =~ /.{5}$/g;

Replies are listed 'Best First'.
Re^2: substr regex alternative
by Your Mother (Archbishop) on Apr 25, 2012 at 13:21 UTC

    With the thin requirements, maybe even go a bit smaller.

    print$string=~/\w+$/g