tags:

views:

60

answers:

1

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?

+4  A: 
$out1 = substr($str1, -3);
cjm