Gunnar Hjalmarsson wrote:
> You can use substr() as an rvalue:
> 
>      substr($str1, 4, 8 - length $str1, $str2);
> 
> or if the length of $str1 is given:
> 
>      substr($str1, 4, -4, $str2);            # probably fastest

i don't understand why the 3rd argument is negative.

given $str1 = 'xxxxyyyyxxxx';
substr($str1, 4, 4) returns 'yyyy';
so wouldn't substr($str1, 4, 4, 'zzzz') replace 'yyyy' with 'zzzz'?

thanks again.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to