Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Re: Re: Make things a *little* easier

by mdillon (Priest)
on Sep 12, 2002 at 15:37 UTC ( #197250=note: print w/replies, xml ) Need Help??


in reply to Re: Re: Make things a *little* easier
in thread a farewell to chop

Yes. Using undef as the third argument does have that effect. I suspect Perl 6 will improve on this somewhat by being able to do: substr $str, -1, replace => '';
This may not seem like much of an improvement, but it gets rid of the undef, which could possibly be mysterious to the uninitiated (as could lvalue substr).

Update: yikes! Using undef doesn't actually work like this (i.e. as the third arg in a Perl-5 substr). I had assumed it did, but it actually acts the same as using 0 as the third arg (at least with 5.8.0). Anyways, the lvalue behavior is stable and documented since 5.6 (possibly earlier); if undef works like this in any Perl version, I haven't seen it documented. Sorry for the foolish mistake (and for the unfounded assumption).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://197250]
help
Chatterbox?
[Discipulus]: oh and only with your left hand!
LanX is relieved!
marto wonders what the hell people are talking about
[LanX]: oh 9 downvotes ... Nick must be back :)

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2018-04-26 10:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?