Extract last K characters from a string in Perl

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);

Need Your Help

Magento - Customer Address Country Dropdown Issue

magento admin magento-1.7 country street-address

I'm using Magento CE, having recently upgraded from And when editing/creating a customer address in the backend, the country dropdown field is blank - with no possible options to s...

Valid to use <a> (anchor tag) without href attribute?

html anchor semantic-markup htmlbutton

I've been using Twitter Bootstrap to build a site, and a lot of its functionality depends on wrapping things in &lt;a&gt;, even if they're just going to execute Javascript. I've had problems with the