Check out example codes for "perl get first characters". It will help you in understanding the concepts better.

Code Example 1

# For Perl (language) only

# syntax
substr(<your-string>,0,<characters-to-extract>)

# example 
substr("Cool, isn't it!",0,4)

# application
my $sRandom = "Cool, isn't it!";
my $s1stFewChars = substr($sRandom,0,4);
print "[ sRandom : '$sRandom' ] \n[ s1stFewChars : '$s1stFewChars' ]" . "\n";

Learn ReactJs, React Native from akashmittal.com