in reply to Re^2: substr outside of string
in thread substr outside of string

Pardon me if I am wrong, but shouldn't it be
if (length($str) > $index) { $s = substr($str, $index, 1); } else { whatever else }