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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With