⭐ in reply to How do I get the Nth Character of a String?
Use substr with a length of one. The character numbering
is zero based so the first character in the string is the
0th element.
$str = "123456789"; $first = substr($str, 0, 1); #returns the first character $third = substr($str, 2, 1); #returns the third character
In Section
Seekers of Perl Wisdom