in reply to regex for string

my ($f,$l) = /^(.).*(?<=(.))/s;

my $f = substr($_, 0, 1); my $l = substr($_, -1, 1);