my $string = 'perl345'; my $tag = substr $string, -3; #### my $string = 'monks 1223'; my $tag = substr $string, -3, 3, '';