$x = '1234'; for (substr($x,1,2)) { # lvalue offset and length start at (1,2) $_ = 'a'; print $x,"\n"; # becomes (1,1) -- prints 1a4, $_ = 'xyz'; print $x,"\n"; # becomes (1,3) -- prints 1xyz4 $x = '56789'; # no change (1,3) $_ = 'pq'; print $x,"\n"; # becomes (1,2) after pq is subbed into (1,3) -- prints 5pq9 }