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?
Use substr:
$out1 = substr($str1, -3);