perl get nth character of a string code example
Example: perl get first characters
# 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";