in reply to substr regex alternative
my $string = "hello world"; print $string =~ /(.{5})$/; #Or print $string =~ /.{5}$/g; [download]
With the thin requirements, maybe even go a bit smaller.