in reply to This is why Perl is so frustrating

substr outside of string at lane_changer.pl line 33.

I don't see $position, $length, $value being defined. Do you have use strict; use warnings; at the top of your program?

Even if those variables are defined somewhere in code you didn't show, it's hardly surprising that you'd get that error, since they haven't been set to values corresponding to the length of the current $line.

Between the mind which plans and the hands which build, there must be a mediator... and this mediator must be the heart.