perl take last two characters of string code example
Example: perl last characters
# For Perl (language) only
# syntax
substr(<your-string>,-<characters-to-extract>)
# example
substr("Glass half empty, glass half full",-15)
# application
my $sRandom = "Glass half empty, glass half full";
my $sLastFewChars = substr($sRandom,-15);
print "[ sRandom : '$sRandom' ] \n[ sLastFewChars : '$sLastFewChars' ]" . "\n";