in reply to Re: What is substring working on here.
in thread What is substring working on here.
The two and three arugment forms of substr return an lvalue (something to which one can assign). When something is assigned to this particular lvalue, it triggers some code in perl's guts gets called which causes the original string to be modified.
I've been told by an esteemed monk or two that the 4 argument form of substr is more efficient than using it as an lvalue.
Replace
substr($str, $start, $length) = $new_sub_str;
with
substr($str, $start, $length, $new_sub_str);
for a performance boost.
|
|---|