Extract last K characters from a string in Perl -
I have a string that looks like this
my $ str1 = "ACGGATATTGA" ; My $ str2 = "alex";
What do I have to do to remove the last three letters from each of those?
$ out1 = "TGA"; $ Out2 = "lex";
How can I do this in Perl?
Usage:
$ out1 = substr ($ str1, - 3);
Comments
Post a Comment