use strict; use warnings; use feature 'say'; my $s = "hello world"; # offset then length say substr($s, 0, 5); # a negative offset counts from the end say substr($s, -5);
substr(EXPR, OFFSET, LENGTH)