Strings In Depth12 / 18
Up next

Extract with substr

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);
What you're solving

substr(EXPR, OFFSET, LENGTH)