substr() as subroutine argument
-
substr()
does not return a string.
- It returns a
special thing - an SV with substr magic.
- If you use substr() in an
rvalue context you can ignore this subtlty.
- If you simply use substr() on the LHS of assignment you can ignore this subtlty.
- If you make a reference or an alais to the value returned by
substr()
you cannot
substr($foo,10,10)='xxx';
substr($foo,10,10,'xxx');
$foo = substr($foo,0,10) . 'xxx' . substr($foo,20);
Next