my $s = (length($str) < $index ? substr($str, $index, 1) : '' # or undef, or die, or ... ); [download]
In reply to Re^3: substr outside of string by ikegami in thread substr outside of string by kulls