develooper Front page | perl.perl5.porters | Postings from November 2003

Re: Question about rules for autovivification

Thread Previous
From:
Mark Mielke
Date:
November 6, 2003 14:32
Subject:
Re: Question about rules for autovivification
Message ID:
20031106223045.GA8980@mark.mielke.cc
On Thu, Nov 06, 2003 at 02:32:30PM -0600, david nicol wrote:
> Is @{undef()} working without error as a lvalue something we should
> repair?
> In situations where @{undef()} is parsing, is it parsing as @{""} ?
>  perl -lwe ' print(@{""}=(1..5))'
> 12345

$ perl -Mstrict -e 'print(@{""}=(1..5))'
Can't use string ("") as an ARRAY ref while "strict refs" in use at -e line 1.

Symbolic references get you into all kinds of trouble, if you are not
careful. Why should only undef() or '' be blocked?

mark

-- 
mark@mielke.cc/markm@ncf.ca/markm@nortelnetworks.com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/


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