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

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

Thread Previous | Thread Next
From:
Father Chrysostomos
Date:
January 3, 2012 10:01
Subject:
Re: defined(@arr), defined (%hash)
Message ID:
20120103180142.1374.qmail@lists-nntp.develooper.com
Ricardo Signes wrote:
> C<defined> does not really impose scalar context as usually understood.  For
> example, defined(&foo) does not call foo in scalar context.  It is its own
> thing, which is, basically, the problem.

This is a syntactic distinction.  defined(&foo), defined(@foo) and defined(%foo) are special cases.  All others (should) work this way (bugs aside):

$ perl -le 'sub context { print qw[void scalar list][wantarray + defined wantarray] } defined context'
scalar


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