develooper Front page | perl.perl5.porters | Postings from January 2012

Re: defined(@arr), defined (%hash)

Thread Previous | Thread Next
Eirik Berg Hanssen
January 3, 2012 08:51
Re: defined(@arr), defined (%hash)
Message ID:
On Tue, Jan 3, 2012 at 3:15 PM, Nicholas Clark <> wrote:

> On Tue, Jan 03, 2012 at 09:08:35AM -0500, Matthew Horsfall (alh) wrote:
> > Though I'm not sure honestly why defined(() = ...) even makes sense;
> seems
> > like that should be its own warning...
> I can't see any sense for it. I think it can only tell you something
> implementation dependent about temporary internal storage. Which, obviously
> is something essential to know about, and never a mistake.

  Now, I'm more of a language guy than an internals guy, but I imagine it
will tell you the Truth – or else surprise people.

  Defined imposes scalar context, and list assignment in scalar context
"returns the number of elements produced by the expression on the right
hand side of the assignment."

  Unless you are proposing to change either of, C< defined(()=...) > should
return whether this number is defined.

  I cannot quite fathom how the number of elements produced could be
undefined, so it looks like that return value will be  a universal Truth.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About