Update: just in case anyone was wondering (as Solo did in a /msg), this is real Perl 5 code. I believe lvalue substr was added in some patchlevel release of Perl 5.005.$str = 'abcde'; substr($str, -1) = ''; print $str, $/;
Update^2: the advantage this has over the 4-arg substr is that you don't need to put the number of chars to replace in the string (which would always be the absolute value of the negative offset in situations like this); it just replaces everything up through the end of the string.
|Replies are listed 'Best First'.|
Re: Re: Make things a *little* easier
by John M. Dlugosz (Monsignor) on Sep 12, 2002 at 14:49 UTC