develooper Front page | perl.perl5.porters | Postings from September 2000

Re: [ID 20000926.002] substr with undef values is not consistant

Thread Previous | Thread Next
From:
Ronald J Kimball
Date:
September 26, 2000 20:32
Subject:
Re: [ID 20000926.002] substr with undef values is not consistant
Message ID:
20000926232814.B560085@linguist.dartmouth.edu
On Tue, Sep 26, 2000 at 11:12:18PM -0400, Clinton A. Pierce wrote:
> Rick Delaney wrote:
> > This is exactly what you get for substr("", 0) and substr("", 1), which
> > makes sense since that's what the "Use of uninitialized value" warning
> > that you've turned off is telling you.  You also get the same for
> > substr("x",1) and substr("x",2) so this seems like a logical
> > progression.
> 
> Hmm...doesn't seem logical to me.  I wasn't interested in the warning at
> all. I knew very well I could be playing with data that wasn't
> initialized.  In fact, I was counting on it in some cases.
> 
> I wanted the behavior of substr to be consistant with undef values.  If
> something is undef, its undef at the beginning and everywhere else
> (undefined has an anywhere else?!  It has a beginning?).  It's just
> undefined, period.

C<undef + 4>, C<"hi!" . undef>, and C< undef << 2 > could all result in
undef, and that would be a reasonable implementation, but it's not how Perl
works.

Ronald

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About