In this article let’s discuss about Perl last characters. Let’s go through the following methods without any delay 🙂
Method 1 : Using substr function
substr has got 3 parameters.
1. The original string
2. Offset – from where the substring starts
3. length – How long the substring is?
# For Perl (language) only
# application my $sRandom = "Glass half empty, glass half full"; my $sLastFewChars = substr($sRandom,18,15); print "[ sRandom : '$sRandom' ] \n[ sLastFewChars : '$sLastFewChars' ]" . "\n";
Output : sRandom :
Hope the above methods works for you. Happy Learning and get back to us Anytime.
Realted Posts : Perl write to file