Extract last K characters from a string in Perl

Viewed 29526

I have a string that looks like this

my $str1 = "ACGGATATTGA";
my $str2 = "alex";

What I want to do is to extract last three characters from each of that.

$out1 = "TGA";
$out2 = "lex";

How can I do it in Perl?

1 Answers
Related