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

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

Thread Previous
From:
Rick Delaney
Date:
September 26, 2000 20:56
Subject:
Re: [ID 20000926.002] substr with undef values is not consistant
Message ID:
39D172AD.2F964F61@home.com

"Clinton A. Pierce" wrote:
> 
> Ronald J Kimball wrote:
> > That is the correct behavior.  substr(undef, 0) is equivalent to
> > substr('', 0), and at the 0th position of '' there is a null string, which
> > is defined.
> 
> And this is documented somewhere?

In perldiag, under "Use of uninitialized value%s".  If undef was
supposed to be treated differently by substr than "", then there would
be no point in a warning.  Just as there's no point in one here:

    $foo = undef;

or here:

    $bar = $foo;

-- 
Rick Delaney
rick.delaney@home.com

Thread Previous


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