in reply to Negative Index with "substr" Not Working

your error must coming from elsewhere..
perl -e "if(length($ARGV[0])==11){print $ARGV[0], (substr($ARGV[0],-10 +,6))}" 1234567890_ 1234567890_234567
Anyway you presented few stroke of your code and it is impossible to tell if $11 come from the 11th capturing group of a regex or is very bad choice for a variable name: it is a special variable.

the code above acts as you expect?

L*
There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.