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

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -